diff --git a/Celeste_Launcher_Gui/Helpers/Steam.cs b/Celeste_Launcher_Gui/Helpers/Steam.cs index a4b5d3c..b76d1b1 100644 --- a/Celeste_Launcher_Gui/Helpers/Steam.cs +++ b/Celeste_Launcher_Gui/Helpers/Steam.cs @@ -7,17 +7,31 @@ public static class Steam { private const string AOEOnlineExecutableName = "AOEOnline.exe"; private const string CelesteLauncherExecutableName = "Celeste Launcher.exe"; + private const string CelesteLauncherExecutableNameCopy = "Celeste Launcher.exe.copy"; public static void ConvertToSteam(string gameBasePath) { var celesteLauncherExePath = Path.Combine(gameBasePath, CelesteLauncherExecutableName); + var celesteLauncherExeCopy = Path.Combine(gameBasePath, CelesteLauncherExecutableNameCopy); var aoeoOnlineExePath = Path.Combine(gameBasePath, AOEOnlineExecutableName); - Misc.MoveFile(celesteLauncherExePath, aoeoOnlineExePath); + OverwriteFile(celesteLauncherExePath, celesteLauncherExeCopy); + Misc.MoveFile(celesteLauncherExeCopy, aoeoOnlineExePath); var celesteLauncherExeConfigPath = Path.Combine(gameBasePath, $"{CelesteLauncherExecutableName}.config"); + var celesteLauncherExeConfigPathCopy = Path.Combine(gameBasePath, $"{CelesteLauncherExecutableNameCopy}.config"); var aoeoOnlineExeConfigPath = Path.Combine(gameBasePath, $"{AOEOnlineExecutableName}.config"); - Misc.MoveFile(celesteLauncherExeConfigPath, aoeoOnlineExeConfigPath); + + OverwriteFile(celesteLauncherExeConfigPath, celesteLauncherExeConfigPathCopy); + Misc.MoveFile(celesteLauncherExeConfigPathCopy, aoeoOnlineExeConfigPath); + } + + private static void OverwriteFile(string source, string target) + { + if (File.Exists(target)) + File.Delete(target); + + File.Copy(source, target); } } } \ No newline at end of file