Posted 13 August 2015 - 02:29 PM
I`ve made a program that can be used instead of going to the lua prompt and typing in the code there. I`m having a problem with the list function recognizing the difference between directories and files, which is done by changing the text color to green for directories. It will work for the root directory, but not for any level past that, "rom/". The code I`m showing is only the section of code for that list function, the only part of code that relates to it is a y = read() at the beginning. Thanks in advance for the help.
elseif y == "l" then --from here, I know that this elseif, it fits with my program.
term.setCursorPos(1,1)
term.clear()
print("Name directory to list from.")
local z = read()
if fs.exists(z) == true then
term.setCursorPos(1,1)
term.clear()
for i,v in ipairs(fs.list(z)) do
if fs.isDir(v) == true then
term.setTextColor(colors.green)
print(i.. ", " ..v)
term.setTextColor(colors.white)
elseif fs.isDir(v) == false then
print(i.. ", " ..v)
else
end
end
elseif fs.exists(z) == false then
term.setCursorPos(1,1)
term.clear()
print("Directory not found.")
os.sleep(1)
term.setCursorPos(1,1)
term.clear()
return
end --To here.