From e01251b73fb0cfb1ea5b4bbb8b994a222224c650 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 f397ffcd5..00b263dab 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);