aboutsummaryrefslogtreecommitdiff
path: root/serialize_lib/atomic.lua
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2021-04-04 19:57:43 +0200
committerorwell96 <orwell@bleipb.de>2021-04-04 19:58:25 +0200
commit5ee8c0e39b6dffc5437e1b48b08cfbeb6ea414d1 (patch)
treec147099e46780125442232b18ca7396aa7a13059 /serialize_lib/atomic.lua
parent3dc6426e861b7c7e7fa14ab82d62a7d818ea0d2e (diff)
parentedcc0d09178bfb64fbaa7620a7b0176d9b57b9d1 (diff)
downloadadvtrains-5ee8c0e39b6dffc5437e1b48b08cfbeb6ea414d1.tar.gz
advtrains-5ee8c0e39b6dffc5437e1b48b08cfbeb6ea414d1.tar.bz2
advtrains-5ee8c0e39b6dffc5437e1b48b08cfbeb6ea414d1.zip
Update serialize_lib
Diffstat (limited to 'serialize_lib/atomic.lua')
-rw-r--r--serialize_lib/atomic.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/serialize_lib/atomic.lua b/serialize_lib/atomic.lua
index 182cf42..4a48c27 100644
--- a/serialize_lib/atomic.lua
+++ b/serialize_lib/atomic.lua
@@ -65,7 +65,7 @@ local function save_atomic_move_file(filename)
end
local function open_file_and_save_callback(callback, filename)
- local file, err = io.open(filename, "w")
+ local file, err = io.open(filename, "wb")
if not file then
error("Failed opening file '"..filename.."' for write:\n"..err)
end
@@ -75,7 +75,7 @@ local function open_file_and_save_callback(callback, filename)
end
local function open_file_and_load_callback(filename, callback)
- local file, err = io.open(filename, "r")
+ local file, err = io.open(filename, "rb")
if not file then
error("Failed opening file '"..filename.."' for read:\n"..err)
end
@@ -97,7 +97,7 @@ function serialize_lib.load_atomic(filename, callback)
local cbfunc = callback or ser.read_from_fd
-- try <filename>
- local file, ret = io.open(filename, "r")
+ local file, ret = io.open(filename, "rb")
if file then
-- read the file using the callback
local success
@@ -117,7 +117,7 @@ function serialize_lib.load_atomic(filename, callback)
serialize_lib.log_warn(ret)
-- try <filename>.new
- file, ret = io.open(filename..".new", "r")
+ file, ret = io.open(filename..".new", "rb")
if file then
-- read the file using the callback
local success
@@ -151,7 +151,7 @@ function serialize_lib.save_atomic(data, filename, callback, config)
local cbfunc = callback or ser.write_to_fd
- local file, ret = io.open(filename..".new", "w")
+ local file, ret = io.open(filename..".new", "wb")
if file then
-- save the file using the callback
local success
@@ -189,7 +189,7 @@ function serialize_lib.save_atomic_multiple(parts_table, filename_prefix, callba
end
local success = false
- local file, ret = io.open(filename..".new", "w")
+ local file, ret = io.open(filename..".new", "wb")
if file then
-- save the file using the callback
success, ret = pcall(cbfunc, data, file, config)