Bug: add_tag
add_tag was creating another folder inside the target path.
This commit is contained in:
parent
b700bd5c77
commit
ea0fceac5e
11
colddb.lua
11
colddb.lua
@ -26,7 +26,7 @@ function colddb.Colddb(dir)
|
|||||||
setmetatable(mem_pool_del, {__mode = "kv"})
|
setmetatable(mem_pool_del, {__mode = "kv"})
|
||||||
setmetatable(indexes_pool, {__mode = "kv"})
|
setmetatable(indexes_pool, {__mode = "kv"})
|
||||||
|
|
||||||
local function file_Exists(name, tag_name)
|
local function file_exists(name, tag_name)
|
||||||
local t = ""
|
local t = ""
|
||||||
if tag_name then
|
if tag_name then
|
||||||
t = self.get_tag(tag_name)
|
t = self.get_tag(tag_name)
|
||||||
@ -180,6 +180,10 @@ function colddb.Colddb(dir)
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
self.exists = function(name, tag_name)
|
||||||
|
return file_exists(name, tag_name)
|
||||||
|
end
|
||||||
|
|
||||||
self.add_tag = function(name, tag, no_new_path)
|
self.add_tag = function(name, tag, no_new_path)
|
||||||
local t = ""
|
local t = ""
|
||||||
if not tags[name] then
|
if not tags[name] then
|
||||||
@ -196,7 +200,7 @@ function colddb.Colddb(dir)
|
|||||||
if no_new_path then
|
if no_new_path then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local test_path = string.format("%s%s%s", directory, tags[name], t)
|
local test_path = string.format("%s%s", directory, tags[name])
|
||||||
if not minetest.mkdir(test_path) then
|
if not minetest.mkdir(test_path) then
|
||||||
error(string.format("%s is not a directory.", test_path))
|
error(string.format("%s is not a directory.", test_path))
|
||||||
end
|
end
|
||||||
@ -271,6 +275,7 @@ function colddb.Colddb(dir)
|
|||||||
if tag_name then
|
if tag_name then
|
||||||
t = self.get_tag(tag_name)
|
t = self.get_tag(tag_name)
|
||||||
end
|
end
|
||||||
|
minetest.log(string.format("%s%s%s.cold", directory, t, name))
|
||||||
return minetest.safe_file_write(string.format("%s%s%s.cold", directory, t, name), minetest.serialize(_table))
|
return minetest.safe_file_write(string.format("%s%s%s.cold", directory, t, name), minetest.serialize(_table))
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -336,7 +341,7 @@ function colddb.Colddb(dir)
|
|||||||
local fs = indexes_pool[cs]
|
local fs = indexes_pool[cs]
|
||||||
if not fs then
|
if not fs then
|
||||||
local p = string.format("%s%s%s.cold", directory, t, name)
|
local p = string.format("%s%s%s.cold", directory, t, name)
|
||||||
if not file_Exists(name,tag_name) then
|
if not file_exists(name,tag_name) then
|
||||||
local f = io.open(p, "w")
|
local f = io.open(p, "w")
|
||||||
if f then
|
if f then
|
||||||
f:seek("set")
|
f:seek("set")
|
||||||
|
Loading…
Reference in New Issue
Block a user