fixed a few stupid bugs with shutil and fs
This commit is contained in:
parent
ba8a800940
commit
72e71c4c23
@ -77,6 +77,7 @@ do
|
||||
return false
|
||||
end
|
||||
function fs.list(s)
|
||||
s=s or ""
|
||||
local _,d,p = fs.resolve(s)
|
||||
if not d then
|
||||
local kt = {}
|
||||
@ -104,3 +105,14 @@ do
|
||||
return fT[d].isDirectory(p)
|
||||
end
|
||||
end
|
||||
function fs.cd(p)
|
||||
if p:sub(1,1) ~= "/" then
|
||||
p=(os.getenv("PWD") or "").."/"..p
|
||||
end
|
||||
p=fs.simplify(p)
|
||||
if fs.exists(p) and fs.isdir(p) then
|
||||
os.setenv("PWD",p)
|
||||
else
|
||||
error("non-existent/not a dir")
|
||||
end
|
||||
end
|
||||
|
@ -1,12 +1,6 @@
|
||||
function cd(p)
|
||||
os.setenv("PWD",fs.simplify((os.getenv("PWD") or "").."/"..p))
|
||||
end
|
||||
cd=fs.cd
|
||||
rm=fs.rm
|
||||
mkdir=fs.mkdir
|
||||
function ls(p)
|
||||
for k,v in ipairs(fs.list(p)) do print(v) end
|
||||
end
|
||||
function rm(p)
|
||||
fs.rm(p)
|
||||
end
|
||||
function mkdir(p)
|
||||
fs.mkdir(p)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user