Commit f5854bff authored by Phil Hagelberg's avatar Phil Hagelberg

Fix ls bug.

parent 79e5c481
......@@ -6,7 +6,8 @@ local lfs = require("love.filesystem")
local fs = {}
local realpath = function(path, cwd)
return "fs/" .. fs.hostname .. "/" .. fs.normalize(path, cwd)
-- fs.normalize always returns a value starting with /
return "fs/" .. fs.hostname .. fs.normalize(path, cwd)
end
-- Actually returns both the dirname and the basename.
......@@ -159,7 +160,7 @@ fs.normalize = function(path, cwd)
for _,segment in pairs(lume.split(path, "/")) do
if(segment == "..") then
table.remove(final, #final)
else
elseif(segment ~= "") then
final[#final + 1] = segment
end
end
......
......@@ -34,7 +34,7 @@ else
env.CWD = env.HOME
elseif(change_dir and not io.exists(change_dir)) then
print(change_dir .. " not found.")
elseif(change_dir and type(io.isdir(change_dir))) then
elseif(change_dir and not io.isdir(change_dir)) then
print(change_dir .. " is not a directory")
elseif(change_dir) then
env.CWD = change_dir
......
......@@ -24,8 +24,11 @@ while true do
-- TODO: range check
dbg(">", require("lume").serialize(msg))
if(msg.op == "kill") then
for _,session in pairs(sessions) do
if(os.kill) then os.kill(session) end
for session_id,session in pairs(sessions) do
if(os.kill) then
os.kill(session)
sessions[session_id] = nil
end
end
return
elseif(msg.op == "login") then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment