diff options
Diffstat (limited to 'src/SMAPI/Framework/Content')
-rw-r--r-- | src/SMAPI/Framework/Content/AssetName.cs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/SMAPI/Framework/Content/AssetName.cs b/src/SMAPI/Framework/Content/AssetName.cs index 4c691b9a..148354a1 100644 --- a/src/SMAPI/Framework/Content/AssetName.cs +++ b/src/SMAPI/Framework/Content/AssetName.cs @@ -119,25 +119,27 @@ namespace StardewModdingAPI.Framework.Content if (prefix is null) return false; + string rawTrimmed = prefix.Trim(); + // asset keys can't have a leading slash, but NormalizeAssetName will trim them - { - string trimmed = prefix.TrimStart(); - if (trimmed.StartsWith('/') || trimmed.StartsWith('\\')) - return false; - } + if (rawTrimmed.StartsWith('/') || rawTrimmed.StartsWith('\\')) + return false; // normalize prefix { string normalized = PathUtilities.NormalizeAssetName(prefix); - string trimmed = prefix.TrimEnd(); - if (trimmed.EndsWith('/') || trimmed.EndsWith('\\')) + // keep trailing slash + if (rawTrimmed.EndsWith('/') || rawTrimmed.EndsWith('\\')) normalized += PathUtilities.PreferredAssetSeparator; prefix = normalized; } // compare + if (prefix.Length == 0) + return true; + return this.Name.StartsWith(prefix, StringComparison.OrdinalIgnoreCase) && ( |