Fix: putting files in wrong folder

This commit is contained in:
Coder12a 2019-03-15 23:55:57 -05:00
parent 45c925efaf
commit 229bd3ea6d

View File

@ -54,7 +54,7 @@ function colddb.Colddb(dir)
end end
local function file_exists(name) local function file_exists(name)
local f = io.open(string.format("%s%s.cold", directory, name), "r") local f = io.open(string.format("%s/%s.cold", directory, name), "r")
if f ~= nil then if f ~= nil then
io.close(f) io.close(f)
return true return true
@ -75,7 +75,7 @@ function colddb.Colddb(dir)
end end
local function delete_file(name) local function delete_file(name)
local text = string.format("%s%s.cold", directory, name) local text = string.format("%s/%s.cold", directory, name)
local err, msg = os.remove(text) local err, msg = os.remove(text)
if err == nil then if err == nil then
@ -84,7 +84,7 @@ function colddb.Colddb(dir)
end end
local function load_table(name) local function load_table(name)
local f = io.open(string.format("%s%s.cold", directory, name), "r") local f = io.open(string.format("%s/%s.cold", directory, name), "r")
if f then if f then
local data = minetest.deserialize(f:read("*a")) local data = minetest.deserialize(f:read("*a"))
f:close() f:close()
@ -94,16 +94,16 @@ function colddb.Colddb(dir)
end end
local function save_table(name, _table) local function save_table(name, _table)
minetest.log(string.format("%s%s.cold", directory, name)) minetest.log(string.format("%s/%s.cold", directory, name))
return minetest.safe_file_write(string.format("%s%s.cold", directory, name), minetest.serialize(_table)) return minetest.safe_file_write(string.format("%s/%s.cold", directory, name), minetest.serialize(_table))
end end
local function save_key(name) local function save_key(name)
return minetest.safe_file_write(string.format("%s%s.cold", directory, name), "") return minetest.safe_file_write(string.format("%s/%s.cold", directory, name), "")
end end
local function load_key(name) local function load_key(name)
local f = io.open(string.format("%s%s.cold", directory, name), "r") local f = io.open(string.format("%s/%s.cold", directory, name), "r")
if f then if f then
f:close() f:close()
return true return true
@ -126,7 +126,7 @@ function colddb.Colddb(dir)
mem_pool_del[name] = nil mem_pool_del[name] = nil
end end
self.clear_mem = function(name) self.clear_mem = function(name)
mem_pool[name] = nil mem_pool[name] = nil
mem_pool_del[name] = nil mem_pool_del[name] = nil
end end