From dec409dc239015424f9d34b3b0685859d77d9039 Mon Sep 17 00:00:00 2001 From: Jake Rosado Date: Sat, 6 Jul 2024 15:14:42 -0400 Subject: [PATCH] Fix trailing space mod load --- src/SMAPI.Toolkit/Utilities/PathUtilities.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/SMAPI.Toolkit/Utilities/PathUtilities.cs b/src/SMAPI.Toolkit/Utilities/PathUtilities.cs index 48a0e780c..8e194a2d0 100644 --- a/src/SMAPI.Toolkit/Utilities/PathUtilities.cs +++ b/src/SMAPI.Toolkit/Utilities/PathUtilities.cs @@ -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);