summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2016-11-05 19:52:39 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2016-11-05 19:52:39 -0400
commit07d0dc38ca210a82264841fd7fe8d2040acee61d (patch)
tree3fdfe078494cf5c93dccef0409ea72cfb611f77c /src
parentbd676a35e21e69fb380f94279043220d3832aba8 (diff)
downloadSMAPI-07d0dc38ca210a82264841fd7fe8d2040acee61d.tar.gz
SMAPI-07d0dc38ca210a82264841fd7fe8d2040acee61d.tar.bz2
SMAPI-07d0dc38ca210a82264841fd7fe8d2040acee61d.zip
fix installer on Windows not ignoring quote characters in file path
Diffstat (limited to 'src')
-rw-r--r--src/StardewModdingAPI.Installer/InteractiveInstaller.cs11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/StardewModdingAPI.Installer/InteractiveInstaller.cs b/src/StardewModdingAPI.Installer/InteractiveInstaller.cs
index 022ac4e6..58bc39f0 100644
--- a/src/StardewModdingAPI.Installer/InteractiveInstaller.cs
+++ b/src/StardewModdingAPI.Installer/InteractiveInstaller.cs
@@ -56,7 +56,7 @@ namespace StardewModdingApi.Installer
this.PrintDebug("Collecting information...");
Platform platform = this.DetectPlatform();
DirectoryInfo packageDir = new DirectoryInfo(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), platform.ToString()));
- DirectoryInfo installDir = this.InteractivelyGetInstallPath();
+ DirectoryInfo installDir = this.InteractivelyGetInstallPath(platform);
string executablePath = Path.Combine(installDir.FullName, platform == Platform.Mono ? "StardewValley.exe" : "Stardew Valley.exe");
string unixGameLauncherPath = Path.Combine(installDir.FullName, "StardewValley");
string unixGameLauncherBackupPath = Path.Combine(installDir.FullName, "StardewValley-original");
@@ -276,7 +276,8 @@ namespace StardewModdingApi.Installer
}
/// <summary>Interactively locate the game's install path.</summary>
- private DirectoryInfo InteractivelyGetInstallPath()
+ /// <param name="platform">The current platform.</param>
+ private DirectoryInfo InteractivelyGetInstallPath(Platform platform)
{
// try default paths
foreach (string defaultPath in this.DefaultInstallPaths)
@@ -292,13 +293,17 @@ namespace StardewModdingApi.Installer
// get path from user
Console.WriteLine(" Enter the game's full directory path (the one containing 'StardewValley.exe' or 'Stardew Valley.exe').");
Console.Write(" > ");
- string path = Console.ReadLine();
+ string path = Console.ReadLine()?.Trim();
if (string.IsNullOrWhiteSpace(path))
{
Console.WriteLine(" You must specify a directory path to continue.");
continue;
}
+ // normalise on Windows
+ if (platform == Platform.Windows)
+ path = path.Replace("\"", ""); // in Windows, quotes are used to escape spaces and aren't part of the file path
+
// get directory
if (File.Exists(path))
path = Path.GetDirectoryName(path);