added filesystem library, is now in the default modules

This commit is contained in:
Izaya 2017-04-20 01:05:59 +10:00
parent 1866c87e90
commit 6bcf6f19a2
5 changed files with 40 additions and 0 deletions

View File

@ -3,5 +3,8 @@ drivers/dterm.lua
library/print.lua
drivers/keyboard.lua
library/net.lua
library/fs-min.lua
library/fs-std.lua
util/fs-automount.lua
applications/luash.lua
base/footer.lua

View File

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

View File

@ -0,0 +1,29 @@
hT = {["_c"]=0}
function fopen(p,m)
local d,p = fres(p)
local f=d.open(p,m)
if f then
hT._c = hT._c + 1
hT[hT._c] = {d,f}
return hT._c
end
return false
end
function fclose(h)
if hT[h] then
hT[h][1].close(hT[h][2])
end
return false
end
function fread(h,n)
if hT[h] then
return hT[h][1].read(hT[h][2],n)
end
return false
end
function fwrite(h,d)
if hT[h] then
return hT[h][1].write(hT[h][2],d)
end
return false
end

View File

@ -0,0 +1 @@
fT.tmp,fT.boot = component.proxy(computer.tmpAddress()),component.proxy(computer.tmpAddress())

View File

@ -0,0 +1 @@
fT.tmp,fT.boot = component.proxy(computer.tmpAddress()),component.proxy(computer.getBootAddress())