'app-plug-in
'menu BASIC Explorer
sub listFiles(basHome, byref htxt)
# add files from BAS_HOME
basHomeFiles = files(basHome+"*.bas")
sort basHomeFiles
for a in basHomeFiles
i++
if i%2 = 1 then
htxt += "
"
else
htxt += "
"
fi
htxt += "" +a +" | "
fullpath = basHome + a
htxt += "[Edit] | "
htxt += "[Run] | "
htxt += "
"
next i
# add final blank
htxt += " |
"
end
env("TITLE=BASIC Explorer")
historyFile = env("BAS_HOME")+"/history.txt"
app = env("PKG_HOME")+"/plugins/filemgr.bas"
if command = "X" then
historyFile = env("BAS_HOME")+"history.txt"
kill historyFile
fi
htxt = ""
if len(command) = 0 OR command = "R" OR len(command) > 1 then
htxt += "[Recent Files]"
else
htxt += "[Recent Files]"
fi
if command = "S" then
htxt += " [Samples]"
else
htxt += " [Samples]"
fi
if command = "H" then
htxt += " [Home]"
else
htxt += " [Home]"
fi
if command = "T" then
htxt += " [Temp]"
else
htxt += " [Temp]"
fi
htxt += "
"
if len(command) = 0 OR (command != "S" and command != "H" and command != "T") then
htxt += "
Recent Files
"
if (exist(historyFile)) then
sortedFiles = 0
open historyFile for input as #1
while not eof (1)
lineinput #1, a
' a = translate(a, "\\", "/")
sortedFiles << a
wend
close #1
i=1
sort sortedFiles
for a in sortedFiles
i++
if i%2 = 1 then
htxt += ""
else
htxt += "
"
fi
htxt += "" +a +" | "
htxt += "[Edit] | "
htxt += "[Run] | "
htxt += "
"
next a
fi
# add the scratch file
scratchFile = env("HOME")+"/.smallbasic/untitled.bas"
i++
if i%2 = 1 then
htxt += ""
else
htxt += "
"
fi
htxt += "untitled.bas | "
htxt += "[Edit] | "
htxt += "[Run] |
"
htxt += " |
"
cmd = env("BAS_HOME")+"recent_files.sbx X"
htxt += "
[Erase History]"
elif command = "S" then
htxt += "
Samples
"
listFiles ENV("BAS_HOME"), htxt
elif command = "H" then
htxt += "
Home
"
listFiles ENV("HOME")+"/", htxt
elif command = "T" then
htxt += "
Temp
"
listFiles ENV("TEMP")+"/", htxt
fi
html htxt, "", 2, 2, xmax+1, ymax+1