summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-02-19 01:29:30 -0500
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-02-19 01:29:30 -0500
commit69ed617e568c9f2e4a15aee4a7bdecba03c13341 (patch)
tree9025cc00ae485594e277c9f650c9a24d9e7c3425 /src
parentc72adcd119d9e96f47f93a2a7d5beb4974dffc0b (diff)
downloadSMAPI-69ed617e568c9f2e4a15aee4a7bdecba03c13341.tar.gz
SMAPI-69ed617e568c9f2e4a15aee4a7bdecba03c13341.tar.bz2
SMAPI-69ed617e568c9f2e4a15aee4a7bdecba03c13341.zip
fix installer not recognising Linux/Mac paths starting with ~ or containing an escaped space
Diffstat (limited to 'src')
-rw-r--r--src/StardewModdingAPI.Installer/InteractiveInstaller.cs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/StardewModdingAPI.Installer/InteractiveInstaller.cs b/src/StardewModdingAPI.Installer/InteractiveInstaller.cs
index 7f59ed2a..7dcd88fd 100644
--- a/src/StardewModdingAPI.Installer/InteractiveInstaller.cs
+++ b/src/StardewModdingAPI.Installer/InteractiveInstaller.cs
@@ -463,9 +463,16 @@ namespace StardewModdingApi.Installer
continue;
}
- // normalise on Windows
+ // normalise path
if (platform == Platform.Windows)
path = path.Replace("\"", ""); // in Windows, quotes are used to escape spaces and aren't part of the file path
+ if (platform == Platform.Mono)
+ path = path.Replace("\\ ", " "); // in Linux/Mac, spaces in paths may be escaped if copied from the command line
+ if (path.StartsWith("~/"))
+ {
+ string home = Environment.GetEnvironmentVariable("HOME") ?? Environment.GetEnvironmentVariable("USERPROFILE");
+ path = Path.Combine(home, path.Substring(2));
+ }
// get directory
if (File.Exists(path))