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
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
io.close(f)
return true
@ -75,7 +75,7 @@ function colddb.Colddb(dir)
end
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)
if err == nil then
@ -84,7 +84,7 @@ function colddb.Colddb(dir)
end
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
local data = minetest.deserialize(f:read("*a"))
f:close()
@ -94,16 +94,16 @@ function colddb.Colddb(dir)
end
local function save_table(name, _table)
minetest.log(string.format("%s%s.cold", directory, name))
return minetest.safe_file_write(string.format("%s%s.cold", directory, name), minetest.serialize(_table))
minetest.log(string.format("%s/%s.cold", directory, name))
return minetest.safe_file_write(string.format("%s/%s.cold", directory, name), minetest.serialize(_table))
end
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
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
f:close()
return true
@ -126,7 +126,7 @@ function colddb.Colddb(dir)
mem_pool_del[name] = nil
end
self.clear_mem = function(name)
self.clear_mem = function(name)
mem_pool[name] = nil
mem_pool_del[name] = nil
end