summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2016-11-29 19:42:27 -0500
committerJesse Plamondon-Willard <github@jplamondonw.com>2016-11-29 19:42:27 -0500
commit5c11483b8ee7db1c2a8fbb8daae812a3c438d055 (patch)
tree8f00b76f8b8eb65790c8d1e1109a853ee30a57a4
parent7e17005c523a34a8d7c31e1945d2e96cb95e829a (diff)
downloadSMAPI-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.
-rw-r--r--release-notes.md1
-rw-r--r--src/StardewModdingAPI.Installer/InteractiveInstaller.cs27
2 files changed, 25 insertions, 3 deletions
diff --git a/release-notes.md b/release-notes.md
index 8a3012ed..7d993986 100644
--- a/release-notes.md
+++ b/release-notes.md
@@ -5,6 +5,7 @@ See [log](https://github.com/CLxS/SMAPI/compare/stable...develop).
For players:
* You can now run most mods on any platform (e.g. run Windows mods on Linux/Mac).
+ * Fixed the normal uninstaller not removing files added by the 'SMAPI for developers' installer.
## 1.2
See [log](https://github.com/CLxS/SMAPI/compare/1.1.1...1.2).
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);
}