Skip to content

Commit

Permalink
Fix trailing space mod load
Browse files Browse the repository at this point in the history
  • Loading branch information
jakerosado committed Jul 6, 2024
1 parent 17f9af7 commit e01251b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/SMAPI.Toolkit/Utilities/PathUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,13 @@ public static string[] GetSegments(string? path, int? limit = null)
#endif
public static string? NormalizePath(string? path)
{
path = path?.Trim();
if (string.IsNullOrEmpty(path))
return path;

// check for trailing space in directory before trimming
if (!path.EndsWith(" "))
path = path.Trim();

// get basic path format (e.g. /some/asset\\path/ => some\asset\path)
string[] segments = PathUtilities.GetSegments(path);
string newPath = string.Join(PathUtilities.PreferredPathSeparator.ToString(), segments);
Expand Down

0 comments on commit e01251b

Please sign in to comment.