Wrote an extended fs library
Should be pretty usable now. Mostly completes #3
This commit is contained in:
parent
33405a3fce
commit
b06887f2d9
@ -5,6 +5,7 @@ drivers/keyboard.lua
|
||||
library/net.lua
|
||||
library/fs-min.lua
|
||||
library/fs-std.lua
|
||||
library/fs-ext.lua
|
||||
util/fs-automount.lua
|
||||
applications/shutil.lua
|
||||
applications/luash.lua
|
||||
|
12
modules/library/fs-ext.lua
Normal file
12
modules/library/fs-ext.lua
Normal file
@ -0,0 +1,12 @@
|
||||
function flist(s)
|
||||
local d,p = fres(s)
|
||||
return d.list(p or "/")
|
||||
end
|
||||
function fmkdir(s)
|
||||
local d,p = fres(s)
|
||||
return d.makeDirectory(p or "/")
|
||||
end
|
||||
function frm(s)
|
||||
local d,p = fres(s)
|
||||
return d.remove(p)
|
||||
end
|
@ -1,6 +1,6 @@
|
||||
fT = {}
|
||||
function fres(p)
|
||||
local fid = (p:match("(%a-):.+") or p:match("/?(%a-)/.+"))
|
||||
local fid = (p:match("(%a-):") or p:match("/?(%a-)/"))
|
||||
local pt = (p:match("%a-:(.+)") or p:match("/?%a-/(.+)"))
|
||||
if fT[fid] ~= nil and pt ~= nil then return fT[fid],pt else return false end
|
||||
if fT[fid] ~= nil then return fT[fid],pt else return false end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user