fix installer not recognising Linux/Mac paths starting with ~ or containing an escaped space

This commit is contained in:
Jesse Plamondon-Willard 2017-02-19 01:29:30 -05:00
parent c72adcd119
commit 69ed617e56
2 changed files with 9 additions and 1 deletions

View File

@ -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:

View File

@ -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))