From 1871440a7bc557155ab294566b9854747726505f Mon Sep 17 00:00:00 2001 From: William JCM Date: Mon, 21 Mar 2022 15:20:36 +0100 Subject: [PATCH] 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. --- src/UESaveFile/UESaveFile.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/UESaveFile/UESaveFile.cpp b/src/UESaveFile/UESaveFile.cpp index 115d3ad..39728b7 100644 --- a/src/UESaveFile/UESaveFile.cpp +++ b/src/UESaveFile/UESaveFile.cpp @@ -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;