From 116a35786e96463485c37a86cb57f86331a33639 Mon Sep 17 00:00:00 2001 From: Jane Roxanne Date: Sun, 15 Mar 2020 11:43:42 -0500 Subject: [PATCH] CPIO fixes, readmes --- lib/fs_arcfs/init.lua | 2 ++ lib/util_cpio/init.lua | 18 +++++++++++++++++- lib/util_urf/init.lua | 5 +++++ mods/io/README.md | 7 +++++++ mods/loader_fuchas/init.lua | 3 ++- mods/loader_fuchas/readme.md | 9 +++++++++ mods/loader_openkernel/init.lua | 1 + 7 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 mods/io/README.md create mode 100644 mods/loader_fuchas/readme.md diff --git a/lib/fs_arcfs/init.lua b/lib/fs_arcfs/init.lua index 779ffdb..1dada5e 100644 --- a/lib/fs_arcfs/init.lua +++ b/lib/fs_arcfs/init.lua @@ -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 diff --git a/lib/util_cpio/init.lua b/lib/util_cpio/init.lua index eec7488..2567d71 100644 --- a/lib/util_cpio/init.lua +++ b/lib/util_cpio/init.lua @@ -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 \ No newline at end of file diff --git a/lib/util_urf/init.lua b/lib/util_urf/init.lua index 481f29e..6345813 100644 --- a/lib/util_urf/init.lua +++ b/lib/util_urf/init.lua @@ -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) diff --git a/mods/io/README.md b/mods/io/README.md new file mode 100644 index 0000000..20864c8 --- /dev/null +++ b/mods/io/README.md @@ -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 \ No newline at end of file diff --git a/mods/loader_fuchas/init.lua b/mods/loader_fuchas/init.lua index e22c9c6..de9134c 100644 --- a/mods/loader_fuchas/init.lua +++ b/mods/loader_fuchas/init.lua @@ -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 diff --git a/mods/loader_fuchas/readme.md b/mods/loader_fuchas/readme.md new file mode 100644 index 0000000..c8d2d97 --- /dev/null +++ b/mods/loader_fuchas/readme.md @@ -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() +``` \ No newline at end of file diff --git a/mods/loader_openkernel/init.lua b/mods/loader_openkernel/init.lua index e69de29..9236bc4 100644 --- a/mods/loader_openkernel/init.lua +++ b/mods/loader_openkernel/init.lua @@ -0,0 +1 @@ +-- lmao \ No newline at end of file