summaryrefslogtreecommitdiff
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
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
-rw-r--r--release-notes.md1
-rw-r--r--src/StardewModdingAPI.Installer/InteractiveInstaller.cs9
2 files changed, 9 insertions, 1 deletions
diff --git a/release-notes.md b/release-notes.md
index 7cce15c4..b827f6bf 100644
--- a/release-notes.md
+++ b/release-notes.md
@@ -10,6 +10,7 @@ For players:
* 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 installer not recognising Linux/Mac paths starting with `~/` or containing an escaped space.
* 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 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))