diff options
-rw-r--r-- | release-notes.md | 1 | ||||
-rw-r--r-- | src/StardewModdingAPI.Installer/InteractiveInstaller.cs | 12 |
2 files changed, 10 insertions, 3 deletions
diff --git a/release-notes.md b/release-notes.md index a277ee4f..7cce15c4 100644 --- a/release-notes.md +++ b/release-notes.md @@ -9,6 +9,7 @@ For players: * Simple nested mod folders are now recognised by SMAPI (e.g. `ModName-1.0\ModName\manifest.json`). * Fixed game's debug output being shown in the console for all users. * Fixed installer errors for some players when deleting files. +* Fixed installer not ignoring potential game folders that don't contain a Stardew Valley exe. * Fixed rare issue where mod dependencies would override SMAPI dependencies and cause unpredictable bugs. For mod developers: diff --git a/src/StardewModdingAPI.Installer/InteractiveInstaller.cs b/src/StardewModdingAPI.Installer/InteractiveInstaller.cs index 86e11d71..1496bedd 100644 --- a/src/StardewModdingAPI.Installer/InteractiveInstaller.cs +++ b/src/StardewModdingAPI.Installer/InteractiveInstaller.cs @@ -435,10 +435,16 @@ namespace StardewModdingApi.Installer /// <param name="platform">The current platform.</param> private DirectoryInfo InteractivelyGetInstallPath(Platform platform) { + // get executable name + string executableFilename = platform == Platform.Windows + ? "Stardew Valley.exe" + : "StardewValley.exe"; + // try default paths foreach (string defaultPath in this.DefaultInstallPaths) { - if (Directory.Exists(defaultPath)) + DirectoryInfo dir = new DirectoryInfo(defaultPath); + if (dir.Exists && dir.EnumerateFiles(executableFilename).Any()) return new DirectoryInfo(defaultPath); } @@ -447,7 +453,7 @@ namespace StardewModdingApi.Installer while (true) { // get path from user - Console.WriteLine($"Type the file path to the game directory (the one containing '{(platform == Platform.Mono ? "StardewValley.exe" : "Stardew Valley.exe")}'), then press enter."); + Console.WriteLine($"Type the file path to the game directory (the one containing '{executableFilename}'), then press enter."); string path = Console.ReadLine()?.Trim(); if (string.IsNullOrWhiteSpace(path)) { @@ -470,7 +476,7 @@ namespace StardewModdingApi.Installer Console.WriteLine(" That directory doesn't seem to exist."); continue; } - if (!directory.EnumerateFiles("*.exe").Any(p => p.Name == "StardewValley.exe" || p.Name == "Stardew Valley.exe")) + if (!directory.EnumerateFiles(executableFilename).Any()) { Console.WriteLine(" That directory doesn't contain a Stardew Valley executable."); continue; |