diff --git a/pk3DS/Game/GameBackup.cs b/pk3DS/Game/GameBackup.cs index e960444..a66fa4a 100644 --- a/pk3DS/Game/GameBackup.cs +++ b/pk3DS/Game/GameBackup.cs @@ -142,13 +142,13 @@ private static int restoreExeFS(GameConfig config, string bak_exefs) { int count = 0; var files = Directory.GetFiles(config.ExeFS); - foreach (var f in files) + foreach (var src in files) { - string dest = Path.Combine(bak_exefs, Path.GetFileName(f)); + string dest = Path.Combine(bak_exefs, Path.GetFileName(src)); if (File.Exists(dest)) { - File.Copy(dest, f); - count++; + try { File.Copy(dest, src, overwrite: true); count++; } + catch { Console.WriteLine("Unable to overwrite backup: " + dest); } } else Console.WriteLine("Unable to find backup: " + dest); @@ -167,8 +167,8 @@ private static int restoreGARC(GameConfig config, string bak_a) string dest = Path.Combine(bak_a, name); if (File.Exists(dest)) { - File.Copy(dest, src); - count++; + try { File.Copy(dest, src, overwrite: true); count++; } + catch { Console.WriteLine("Unable to overwrite backup: " + dest); } } else Console.WriteLine("Unable to find backup: " + dest); @@ -195,8 +195,8 @@ private static int restoreDLL(GameConfig config, string bak_dll) string dest = Path.Combine(bak_dll, Path.GetFileName(src)); if (File.Exists(dest)) { - File.Copy(dest, src); - count++; + try { File.Copy(dest, src, overwrite: true); count++; } + catch { Console.WriteLine("Unable to overwrite backup: " + dest); } } else Console.WriteLine("Unable to find backup: " + dest);