CPIO fixes, readmes

This commit is contained in:
Jane Roxanne 2020-03-15 11:43:42 -05:00
parent 25779bd202
commit 116a35786e
7 changed files with 43 additions and 2 deletions

View File

@ -3,6 +3,8 @@ local arcfs = {}
function arcfs.make(arc)
local proxy = {}
local function ni()return nil, "not implemented"end
proxy.remove = ni
proxy.makeDirectory = ni
function proxy.exists(path)
end

View File

@ -70,13 +70,29 @@ function arc:fetch(path)
return nil, "file not found"
end
function arc:exists(path)
for i=1, #self.tbl do
if (self.tbl[i].name == path) then
return true
end
end
return false
end
function arc:close()
self.fs.close(self.handle)
self.tbl = {}
end
function arc:list_dir(path)
--soon:tm:
if path:sub(#path) ~= "/" then path = path .. "/" end
local ent = {}
for i=1, #self.tbl do
if (self.tbl[i].name:sub(1, #path) == path and not self.tbl[i].name:find("/", #path+1, false)) then
ent[#ent+1] = self.tbl[i].name
end
end
return ent
end
return cpio

View File

@ -268,6 +268,11 @@ function arc:fetch(path)
return self.fs.read(self.h, obj.size)
end
function arc:exists(path)
local obj = path_to_obj(path)
return obj.type ~= "eoh"
end
function arc:close()
self.cache = nil
self.fs.close(self.h)

7
mods/io/README.md Normal file
View File

@ -0,0 +1,7 @@
# io module (Incomplete)
The IO module provides a PUC Lua-compatible I/O library.
## Additions from PUC Lua
* `io.mkdir(path)` - Makes a directory
* `io.isreadonly(path)` - Returns if path is read only
* `io.exists(path)` - Returns if path exists

View File

@ -18,10 +18,11 @@ function fuchas:boot()
while true do if computer.pullSignal() == "fuchas_dead" then break end end
end
return function(addr, args)
return function(addr)
--oefi.getExtensions().ZyNeo_ExecOEFIApp(addr, ".efi/fuchas.efi2", ...)
--We don't do that here.
local fuch = {}
fuch.args = {}
fuch.env = oefi.getExtensions().ZyNeo_GetOEFIEnv(addr)
fuch.env.computer.supportsOEFI = function()
return true

View File

@ -0,0 +1,9 @@
# Fuchas laoder
This module provides a loader for the Fuchas operating system.
# Example usage
```lua
local fuch = loadmod("loader_fuchas")(address)
fuch:karg("key", "value")
fuch:boot()
```

View File

@ -0,0 +1 @@
-- lmao