diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2016-11-29 19:42:27 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2016-11-29 19:42:27 -0500 |
commit | 5c11483b8ee7db1c2a8fbb8daae812a3c438d055 (patch) | |
tree | 8f00b76f8b8eb65790c8d1e1109a853ee30a57a4 /src/StardewModdingAPI.Installer | |
parent | 7e17005c523a34a8d7c31e1945d2e96cb95e829a (diff) | |
download | SMAPI-5c11483b8ee7db1c2a8fbb8daae812a3c438d055.tar.gz SMAPI-5c11483b8ee7db1c2a8fbb8daae812a3c438d055.tar.bz2 SMAPI-5c11483b8ee7db1c2a8fbb8daae812a3c438d055.zip |
rework uninstaller so it doesn't depend on install package
For example, this avoids an issue where the normal SMAPI uninstaller didn't remove files added by the 'SMAPI for developers' installer.
Diffstat (limited to 'src/StardewModdingAPI.Installer')
-rw-r--r-- | src/StardewModdingAPI.Installer/InteractiveInstaller.cs | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/StardewModdingAPI.Installer/InteractiveInstaller.cs b/src/StardewModdingAPI.Installer/InteractiveInstaller.cs index 5be9b14c..1d3802ab 100644 --- a/src/StardewModdingAPI.Installer/InteractiveInstaller.cs +++ b/src/StardewModdingAPI.Installer/InteractiveInstaller.cs @@ -27,6 +27,27 @@ namespace StardewModdingApi.Installer @"C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley" }; + /// <summary>The files to remove when uninstalling SMAPI.</summary> + private readonly string[] UninstallFiles = + { + // common + "StardewModdingAPI.exe", + "StardewModdingAPI-settings.json", + "StardewModdingAPI.AssemblyRewriters.dll", + "steam_appid.txt", + + // Linux/Mac only + "Mono.Cecil.dll", + "Mono.Cecil.Rocks.dll", + "Newtonsoft.Json.dll", + "StardewModdingAPI", + "StardewModdingAPI.exe.mdb", + "System.Numerics.dll", + + // Windows only + "StardewModdingAPI.pdb" + }; + /********* ** Public methods @@ -47,7 +68,7 @@ namespace StardewModdingApi.Installer /// /// Uninstall logic: /// 1. On Linux/Mac: if a backup of the launcher exists, delete the launcher and restore the backup. - /// 2. Delete all files in the game directory matching a file under package/Windows or package/Mono. + /// 2. Delete all files in the game directory matching one of the <see cref="UninstallFiles"/>. /// </remarks> public void Run(string[] args) { @@ -127,9 +148,9 @@ namespace StardewModdingApi.Installer // remove SMAPI files this.PrintDebug("Removing SMAPI files..."); - foreach (FileInfo sourceFile in packageDir.EnumerateFiles()) + foreach (string filename in this.UninstallFiles) { - string targetPath = Path.Combine(installDir.FullName, sourceFile.Name); + string targetPath = Path.Combine(installDir.FullName, filename); if (File.Exists(targetPath)) File.Delete(targetPath); } |