more permission checks

This commit is contained in:
Izaya 2017-10-08 14:50:03 +11:00
parent 0341a38a5b
commit 5ef48aeb64

View File

@ -143,6 +143,7 @@ do
return false
end
function fs.list(s)
if not canread(s) then return false end
s=s or ""
local _,d,p = fs.resolve(s)
if not d then
@ -159,6 +160,7 @@ do
return fT[d].makeDirectory(p or "/")
end
function fs.rm(s)
if not canwrite(s) then return false end
local _,d,p = fs.resolve(s)
return fT[d].remove(p)
end
@ -234,6 +236,8 @@ function fs.cd(p)
end
end
function fs.cp(s,d)
if not fs.canread(s) then return false end
if not fs.canwrite(d) then return false end
local df = fs.open(d,"wb")
local sf = fs.open(s,"rb")
if df and sf then