diff options
author | orwell96 <orwell@bleipb.de> | 2021-01-17 10:27:16 +0100 |
---|---|---|
committer | orwell96 <orwell@bleipb.de> | 2021-01-17 10:27:16 +0100 |
commit | 7fa1a402bf098fa21fc0d32899885d1203e441b6 (patch) | |
tree | 2609629d695808412d1cf513810ff5743e6d2af4 /serialize_lib/atomic.lua | |
parent | 6202c1cb009d24342a8f59a5500178c41d746489 (diff) | |
download | advtrains-7fa1a402bf098fa21fc0d32899885d1203e441b6.tar.gz advtrains-7fa1a402bf098fa21fc0d32899885d1203e441b6.tar.bz2 advtrains-7fa1a402bf098fa21fc0d32899885d1203e441b6.zip |
Fix atomic saving on windows when save file does not exist
Diffstat (limited to 'serialize_lib/atomic.lua')
-rw-r--r-- | serialize_lib/atomic.lua | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/serialize_lib/atomic.lua b/serialize_lib/atomic.lua index 85937db..182cf42 100644 --- a/serialize_lib/atomic.lua +++ b/serialize_lib/atomic.lua @@ -38,9 +38,9 @@ local function save_atomic_move_file(filename) if windows_mode then local delsucc, err = os.remove(filename) if not delsucc then - serialize_lib.log_error("Unable to delete old savefile '"..filename.."':") - serialize_lib.log_error(err) - return nil, err + serialize_lib.log_warn("Unable to delete old savefile '"..filename.."':") + serialize_lib.log_warn(err) + serialize_lib.log_info("Trying to replace the save file anyway now...") end end @@ -48,11 +48,13 @@ local function save_atomic_move_file(filename) local mvsucc, err = os.rename(filename..".new", filename) if not mvsucc then if minetest.settings:get_bool("serialize_lib_no_auto_windows_mode") or windows_mode then - serialize_lib.log_error("Unable to move '"..filename.."':") + serialize_lib.log_error("Unable to replace save file '"..filename.."':") serialize_lib.log_error(err) return nil, err else -- enable windows mode and try again + serialize_lib.log_info("Unable to replace save file '"..filename.."' by direct renaming:") + serialize_lib.log_info(err) serialize_lib.log_info("Enabling Windows mode for atomic saving...") windows_mode = true return save_atomic_move_file(filename) |