Remove insecure environment

It did not delete the empty folder anyway.
This commit is contained in:
Coder12a 2018-11-06 14:57:52 -06:00
parent 6dce241a2a
commit 0958f312e0
3 changed files with 3 additions and 17 deletions

View File

@ -116,7 +116,7 @@ API
- **colddb.add_global_tag(db,tag)** - **colddb.add_global_tag(db,tag)**
Add an extra folder to the directory and advance the database to the added folder. Adds an extra folder to the directory and advance the database to the added folder.
- **colddb.add_tag(db,name,tag)** - **colddb.add_tag(db,name,tag)**

View File

@ -1,7 +1,5 @@
colddb = {} colddb = {}
local ie = ...
local function createDir(directory) local function createDir(directory)
return minetest.mkdir(directory) return minetest.mkdir(directory)
end end
@ -98,13 +96,7 @@ function colddb.remove_tag(db,name)
local wc = delete_path:len() local wc = delete_path:len()
delete_path = delete_path:sub(0,wc-1) delete_path = delete_path:sub(0,wc-1)
db.tags[name] = nil db.tags[name] = nil
local err,msg = os.remove(delete_path) os.remove(delete_path)
if err == nil and ie then
local err,msg = ie.os.remove(delete_path)
if err == nil and ie then
assert(ie, "Please add colddb to secure.trusted_mods in the settings")
end
end
end end
end end

View File

@ -1,8 +1,2 @@
modpath = minetest.get_modpath("colddb") modpath = minetest.get_modpath("colddb")
local ie = minetest.request_insecure_environment()
if ie then
loadfile(modpath .. "/colddb.lua")(ie)
else
dofile(modpath .. "/colddb.lua") dofile(modpath .. "/colddb.lua")
end