Posted 16 December 2013 - 02:57 PM
Hello.
Im working on a sandbox machine, which listen for a command, split the command by the spaces ( therefore string.gsub ), but it has to keep the symbols like "/" og "\"….
Why doesn't it do that?
And btw:
Does anyone know in which "folder" a sandbox is normally stored in?
like in .sys/.progs./.security/sandbox or something like that
Thanks in Advance
Im working on a sandbox machine, which listen for a command, split the command by the spaces ( therefore string.gsub ), but it has to keep the symbols like "/" og "\"….
Why doesn't it do that?
Spoiler
-- sandbox ADVLOCK --
local mainPath=".advlock/"
local data={
["paths"]={
_sandbox=mainPath..".system/sandbox";
_system=mainPath..".system/";
};
["visible"]={
_sandbox="sandbox";
};
}
if not fs.isDir(mainPath..".system/") then
fs.makeDir(mainPath..".system/")
end
if not fs.isDir(data["paths"]._sandbox) then
fs.makeDir(data["paths"]._sandbox)
end
local promptColour, textColour, bgColour
if term.isColour() then
warningColour = colors.red
promptColour = colours.yellow
textColour = colours.white
bgColour = colours.black
else
warningColour = colors.white
promptColour = colours.white
textColour = colours.white
bgColour = colours.black
end
function curDir()
local dictionary=shell.dir():gsub(".advlock/.system/","")
return dictionary
end
--shell.setDir(data["paths"]._system)
shell.setDir(data["paths"]._sandbox)
term.setBackgroundColor(bgColour)
while true do
term.setTextColor(promptColour)
term.write(curDir().."> ")
term.setTextColor(textColour)
local command = "cd /"--read()
print(command)
local tbl = {}
for w in string.gmatch(command,"%a+") do
tbl[#tbl+1]=tostring(w)
end
print(textutils.serialize(tbl))
term.setTextColor(promptColour)
if command == "break" then
break
elseif command == "cd" then
if curDir() == "sandbox" then
term.setTextColour(warningColour)
textutils.slowPrint("AdvLockSandBox: \nThis is the main dictionary!")
term.setTextColor(promptColour)
end
shell.setDir(data["paths"]._sandbox)
else
shell.run(command)
end
break
end
shell.setDir("")
And btw:
Does anyone know in which "folder" a sandbox is normally stored in?
like in .sys/.progs./.security/sandbox or something like that
Thanks in Advance
Edited on 16 December 2013 - 02:00 PM