Merge commit 'd4593491efbcab47efd918d7918b97b4621828b3'

This commit is contained in:
orwell96 2021-05-03 22:06:02 +02:00
commit 81cd305aa0
2 changed files with 7 additions and 1 deletions

View File

@ -107,7 +107,7 @@ function serialize_lib.load_atomic(filename, callback)
end end
end end
if minetest.settings:get_bool("serialize_lib_strict_loading") then if minetest.settings:get_bool("serialize_lib_strict_loading", true) then
serialize_lib.save_lock = true serialize_lib.save_lock = true
error("Loading data from file '"..filename.."' failed:\n" error("Loading data from file '"..filename.."' failed:\n"
..ret.."\nDisable Strict Loading to ignore.") ..ret.."\nDisable Strict Loading to ignore.")

View File

@ -117,6 +117,8 @@ function read_table(t, file)
file:close() file:close()
error("Unexpected EOF or read error!") error("Unexpected EOF or read error!")
end end
-- possibly windows fix: strip trailing \r's from line
line = string.gsub(line, "\r$", "")
if line=="E" then if line=="E" then
-- done with this table -- done with this table
@ -203,6 +205,8 @@ end
-- config: see above -- config: see above
local function read_from_fd(file) local function read_from_fd(file)
local first_line = file:read("*line") local first_line = file:read("*line")
-- possibly windows fix: strip trailing \r's from line
first_line = string.gsub(first_line, "\r$", "")
if not string.match(first_line, "LUA_SER v=[12]") then if not string.match(first_line, "LUA_SER v=[12]") then
file:close() file:close()
error("Expected header, got '"..first_line.."' instead!") error("Expected header, got '"..first_line.."' instead!")
@ -210,6 +214,8 @@ local function read_from_fd(file)
local t = {} local t = {}
read_table(t, file) read_table(t, file)
local last_line = file:read("*line") local last_line = file:read("*line")
-- possibly windows fix: strip trailing \r's from line
last_line = string.gsub(last_line, "\r$", "")
file:close() file:close()
if last_line ~= "END_SER" then if last_line ~= "END_SER" then
error("Missing END_SER, got '"..last_line.."' instead!") error("Missing END_SER, got '"..last_line.."' instead!")