working filesystem (tested: mkdir, open, file:writeLine/close, cp, mv, rm)

Former-commit-id: ce3fcae801291f770ed19dce4616b8ab61556f9b
Former-commit-id: 999d637fac1c1c6a9ff855ebb8f7f37336519771
This commit is contained in:
Song Minjae
2016-09-17 23:38:16 +09:00
parent a0afc8ab7a
commit df8471c352
14 changed files with 512 additions and 70 deletions

View File

@@ -133,14 +133,14 @@ local function cHexToInt(c)
end
end
-- str, str, str
-- str, str, str
term.blit = function(text, foreCol, backCol)
assert(
type(text) == "string" and type(backCol) == "string" and type(foreCol) == "string",
"bad argument: (string, string, string expected, got "..type(text)..", "..type(foreCol)..", "..type(backCol)..")"
)
if #text ~= #foreCol or #text ~= #backCol or #foreCol ~= #backCol then
error("rrguments must be the same length")
error("arguments must be the same length")
end
for i = 1, #text do
@@ -162,7 +162,20 @@ term.setBackgroundColor = function(cccol) term.setBackCol(ccToGameCol[normaliseC
term.getBackgroundColor = function() return term.getBackCol() end
--------------------
-- FILESYSTEM API --
--------------------
fs.makeDir = function(p) fs.mkdir(p) end
fs.move = function(a, b) fs.mv(a, b) end
fs.copy = function(a, b) fs.cp(a, b) end
fs.delete = function(p) fs.rm(p) end
fs.combine = function(a, b) return fs.concat(a, b) end
fs.getDir = function(p) return fs.parent(p) end
------------------
-- DOWN AND OUT --
------------------
if _COMPUTER.verbose then print("ComputerCraft compatibility layer successfully loaded.") end

View File

@@ -27,6 +27,8 @@ require("ROMLIB")
-- load bios, if any
-- load Lua prompt, if bios is not found
print("Rom basic " .. _COMPUTER.DC2 .. _VERSION .. _COMPUTER.DC4)
-- print(_COMPUTER.DC2 .. freemem .. _COMPUTER.DC4 .. " bytes free"