add filesystem

This commit is contained in:
unknown
2022-02-13 00:31:20 -05:00
parent ef2ceed755
commit 4cfacb1abc
19 changed files with 148 additions and 16 deletions

View File

@ -0,0 +1,7 @@
{
"name": "touch",
"license": "MIT",
"version": 0.1,
"engine": 0.4,
"help": "creates a file in the current path"
}

View File

@ -0,0 +1,14 @@
function touch(pos, input, data)
local path = computers.devicepath .. "/" .. minetest.hash_node_position(pos) .. data.element.pwd
--make dir to be safe
minetest.mkdir(path)
if input and input ~= "" and not input:find("/") then
minetest.safe_file_write(path .. "/" .. input, "")
return "file " .. input .. " created"
else
return "invalid or missing input"
end
end
return touch