Wrote an extended fs library

Should be pretty usable now. Mostly completes #3
This commit is contained in:
Izaya 2017-04-23 11:03:43 +10:00
parent 33405a3fce
commit b06887f2d9
3 changed files with 15 additions and 2 deletions

View File

@ -5,6 +5,7 @@ drivers/keyboard.lua
library/net.lua library/net.lua
library/fs-min.lua library/fs-min.lua
library/fs-std.lua library/fs-std.lua
library/fs-ext.lua
util/fs-automount.lua util/fs-automount.lua
applications/shutil.lua applications/shutil.lua
applications/luash.lua applications/luash.lua

View 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

View File

@ -1,6 +1,6 @@
fT = {} fT = {}
function fres(p) 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-/(.+)")) 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 end