added filesystem library, is now in the default modules
This commit is contained in:
parent
1866c87e90
commit
6bcf6f19a2
@ -3,5 +3,8 @@ drivers/dterm.lua
|
|||||||
library/print.lua
|
library/print.lua
|
||||||
drivers/keyboard.lua
|
drivers/keyboard.lua
|
||||||
library/net.lua
|
library/net.lua
|
||||||
|
library/fs-min.lua
|
||||||
|
library/fs-std.lua
|
||||||
|
util/fs-automount.lua
|
||||||
applications/luash.lua
|
applications/luash.lua
|
||||||
base/footer.lua
|
base/footer.lua
|
||||||
|
6
modules/library/fs-min.lua
Normal file
6
modules/library/fs-min.lua
Normal 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
|
29
modules/library/fs-std.lua
Normal file
29
modules/library/fs-std.lua
Normal 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
|
1
modules/util/fs-automount-min.lua
Normal file
1
modules/util/fs-automount-min.lua
Normal file
@ -0,0 +1 @@
|
|||||||
|
fT.tmp,fT.boot = component.proxy(computer.tmpAddress()),component.proxy(computer.tmpAddress())
|
1
modules/util/fs-automount.lua
Normal file
1
modules/util/fs-automount.lua
Normal file
@ -0,0 +1 @@
|
|||||||
|
fT.tmp,fT.boot = component.proxy(computer.tmpAddress()),component.proxy(computer.getBootAddress())
|
Loading…
Reference in New Issue
Block a user