priv gate things + bugfixes

This commit is contained in:
unknown
2022-02-13 10:43:41 -05:00
parent 3e4e65e01b
commit 2593c55ee3
9 changed files with 33 additions and 12 deletions

View File

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

View File

@ -4,6 +4,11 @@ function touch(pos, input, data)
minetest.mkdir(path)
if input and input ~= "" and not input:find("/") then
for _, item in pairs(minetest.get_dir_list(path, nil)) do
if item == input then
return "ERROR: trying to create already existing file/folder"
end
end
minetest.safe_file_write(path .. "/" .. input, "")
return "file " .. input .. " created"
else