fix installer not recognising Linux/Mac paths starting with ~ or containing an escaped space
This commit is contained in:
parent
c72adcd119
commit
69ed617e56
|
@ -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:
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue