Skip to content

Commit 03be70b

Browse files
CopilotBornToBeRoot
andcommitted
Fix backup file copy to allow overwrite for same-timestamp scenarios
Co-authored-by: BornToBeRoot <[email protected]>
1 parent a1037c3 commit 03be70b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Source/NETworkManager.Settings/SettingsManager.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,11 @@ public static void Load()
152152
Save();
153153

154154
// Backup the old XML file with timestamp to avoid overwriting existing backups
155+
// If a backup with the same timestamp exists (unlikely), it will be overwritten
156+
// since it represents the same migration attempt
155157
var backupFilePath = Path.Combine(GetSettingsFolderLocation(),
156158
$"{SettingsFileName}_{TimestampHelper.GetTimestamp()}{LegacySettingsFileExtension}.backup");
157-
File.Copy(legacyFilePath, backupFilePath, false);
159+
File.Copy(legacyFilePath, backupFilePath, true);
158160
Log.Info($"Legacy XML settings file backed up to: {backupFilePath}");
159161

160162
// Note: The original XML file is intentionally not deleted to allow users to revert if needed.

0 commit comments

Comments
 (0)