diff --git a/AlotAddOnGUI/App.xaml.cs b/AlotAddOnGUI/App.xaml.cs index c7a435d5..b3c79f1b 100644 --- a/AlotAddOnGUI/App.xaml.cs +++ b/AlotAddOnGUI/App.xaml.cs @@ -96,8 +96,9 @@ public App() : base() Log.Information("In update mode. Update destination: " + updateDestinationPath); Log.Information("Applying update"); CopyDir.CopyAll(new DirectoryInfo(System.AppDomain.CurrentDomain.BaseDirectory), new DirectoryInfo(updateDestinationPath)); - Log.Information("Update files have been applied"); + Log.Information("Update files have been applied."); updateDestinationPath += "\\"; //add slash + Log.Information("Performing update migrations..."); if (Directory.Exists(updateDestinationPath + "MEM_Packages") && !Directory.Exists(updateDestinationPath + @"Data\MEM_Packages")) { Log.Information("Migrating MEM_Packages folder into subfolder"); @@ -112,22 +113,35 @@ public App() : base() if (Directory.Exists(updateDestinationPath + "bin")) { - Log.Information("Deleting old top level bin folder"); - Directory.Delete(updateDestinationPath + "bin"); + Log.Information("Deleting old top level bin folder: "+(updateDestinationPath + "bin")); + Utilities.DeleteFilesAndFoldersRecursively(updateDestinationPath + "bin"); } if (Directory.Exists(updateDestinationPath + "lib")) { Log.Information("Deleting old top level lib folder"); - Directory.Delete(updateDestinationPath + "lib"); + Utilities.DeleteFilesAndFoldersRecursively(updateDestinationPath + "lib"); } if (Directory.Exists(updateDestinationPath + "Extracted_Mods")) { Log.Information("Deleting leftover Extracted_Mods folder"); - Directory.Delete(updateDestinationPath + "Extracted_Mods"); + Utilities.DeleteFilesAndFoldersRecursively(updateDestinationPath + "Extracted_Mods"); } - + + if (File.Exists(updateDestinationPath + "manifest.xml")) + { + Log.Information("Deleting leftover manifest.xml file"); + File.Delete(updateDestinationPath + "manifest.xml"); + } + + if (File.Exists(updateDestinationPath + "manifest-bundled.xml")) + { + Log.Information("Deleting leftover manifest-bundled.xml file"); + File.Delete(updateDestinationPath + "manifest-bundled.xml"); + } + + Log.Information("Rebooting into normal mode to complete update: " + updateDestinationPath + System.AppDomain.CurrentDomain.FriendlyName); ProcessStartInfo psi = new ProcessStartInfo(updateDestinationPath + System.AppDomain.CurrentDomain.FriendlyName); psi.WorkingDirectory = updateDestinationPath; psi.Arguments = "--completing-update"; diff --git a/AlotAddOnGUI/MainWindow.xaml.cs b/AlotAddOnGUI/MainWindow.xaml.cs index 7f5ddabd..ab0ba9c4 100644 --- a/AlotAddOnGUI/MainWindow.xaml.cs +++ b/AlotAddOnGUI/MainWindow.xaml.cs @@ -1908,7 +1908,7 @@ private async Task InstallPrecheck(int game) //Check game has been run at least once string configFile = IniSettingsHandler.GetConfigIniPath(game); - if (!File.Exists(configFile)) + if (game == 1 && !File.Exists(configFile)) { //game has not been run yet. Log.Error("Config file missing for Mass Effect " + game + ". Blocking install");