UESaveFile: copy the temp file over the old one.

This is to prevent an issue where updating a profile save makes the app
think it's deleted.
This commit is contained in:
Guillaume Jacquemin 2022-03-21 15:20:36 +01:00
parent 133c34f5f7
commit 1871440a7b
1 changed files with 4 additions and 5 deletions

View File

@ -128,13 +128,12 @@ auto UESaveFile::saveToFile() -> bool {
return false;
}
if(!Utility::Path::remove(_filepath)) {
if(!Utility::Path::copy(_filepath + ".tmp"_s, _filepath)) {
Utility::Path::copy(_filepath + ".bak"_s, _filepath);
return false;
}
if(!Utility::Path::move(_filepath + ".tmp"_s, _filepath)) {
Utility::Path::move(_filepath + ".bak"_s, _filepath);
return false;
else {
Utility::Path::remove(_filepath + ".tmp"_s);
}
_noReloadAfterSave = true;