From c0ed056440ef4c1a94bc622a874d40df256b5b75 Mon Sep 17 00:00:00 2001 From: Tixx <83774803+WiserTixx@users.noreply.github.com> Date: Thu, 17 Jul 2025 14:33:25 +0200 Subject: [PATCH] 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 --- src/Startup.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Startup.cpp b/src/Startup.cpp index 9ab0eae..518eee7 100644 --- a/src/Startup.cpp +++ b/src/Startup.cpp @@ -185,8 +185,14 @@ void CheckForUpdates(const std::string& CV) { "&pk=" + PublicKey + "&branch=" + Branch, beammp_wide("new_") + EP); + std::error_code 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(beammp_wide("new_") + EP, EP); URelaunch(); #endif