mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2025-08-16 08:16:20 +00:00
Fix for backup failing when it's in use
The backup file may still be in use by older launcher versions (v2.0.71) if they update
This commit is contained in:
parent
e6e5bf8327
commit
c0ed056440
@ -185,8 +185,14 @@ void CheckForUpdates(const std::string& CV) {
|
|||||||
"&pk="
|
"&pk="
|
||||||
+ PublicKey + "&branch=" + Branch,
|
+ PublicKey + "&branch=" + Branch,
|
||||||
beammp_wide("new_") + EP);
|
beammp_wide("new_") + EP);
|
||||||
|
std::error_code ec;
|
||||||
fs::remove(Back, ec);
|
fs::remove(Back, ec);
|
||||||
|
if (ec == std::errc::permission_denied) {
|
||||||
|
error("Failed to remove old backup file: " + ec.message() + ". Using alternative name.");
|
||||||
|
fs::rename(EP, Back + beammp_wide(".") + Utils::ToWString(FileHash.substr(0, 8)));
|
||||||
|
} else {
|
||||||
fs::rename(EP, Back);
|
fs::rename(EP, Back);
|
||||||
|
}
|
||||||
fs::rename(beammp_wide("new_") + EP, EP);
|
fs::rename(beammp_wide("new_") + EP, EP);
|
||||||
URelaunch();
|
URelaunch();
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user