diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-02-19 01:07:04 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-02-19 01:07:04 -0500 |
commit | a893cd9eeabdd88bd57a4b7e422de5f1d442073c (patch) | |
tree | 1cea90411b05f621db8d0d48e7f0d9597bf50708 /src/StardewModdingAPI.Installer | |
parent | b2efd34fec00a952cd7d2ebdc02a2c2be506380e (diff) | |
download | SMAPI-a893cd9eeabdd88bd57a4b7e422de5f1d442073c.tar.gz SMAPI-a893cd9eeabdd88bd57a4b7e422de5f1d442073c.tar.bz2 SMAPI-a893cd9eeabdd88bd57a4b7e422de5f1d442073c.zip |
fix installer not ignoring potential game folders that don't contain a Stardew Valley exe
Diffstat (limited to 'src/StardewModdingAPI.Installer')
-rw-r--r-- | src/StardewModdingAPI.Installer/InteractiveInstaller.cs | 12 |
1 files changed, 9 insertions, 3 deletions
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; |