From c1342bd4cd6b75b24d11275bdd73ebf893f916ea Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 4 May 2022 20:35:08 -0400 Subject: disable case-insensitive paths by default pending performance rework --- src/SMAPI/Framework/ModHelpers/ModContentHelper.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/SMAPI/Framework/ModHelpers/ModContentHelper.cs') diff --git a/src/SMAPI/Framework/ModHelpers/ModContentHelper.cs b/src/SMAPI/Framework/ModHelpers/ModContentHelper.cs index def0b728..74ea73de 100644 --- a/src/SMAPI/Framework/ModHelpers/ModContentHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/ModContentHelper.cs @@ -4,7 +4,7 @@ using StardewModdingAPI.Framework.Content; using StardewModdingAPI.Framework.ContentManagers; using StardewModdingAPI.Framework.Exceptions; using StardewModdingAPI.Framework.Reflection; -using StardewModdingAPI.Toolkit.Utilities; +using StardewModdingAPI.Toolkit.Utilities.PathLookups; namespace StardewModdingAPI.Framework.ModHelpers { @@ -23,8 +23,8 @@ namespace StardewModdingAPI.Framework.ModHelpers /// The friendly mod name for use in errors. private readonly string ModName; - /// A case-insensitive lookup of relative paths within the . - private readonly CaseInsensitivePathLookup RelativePathCache; + /// A lookup for relative paths within the . + private readonly IFilePathLookup RelativePathLookup; /// Simplifies access to private code. private readonly Reflector Reflection; @@ -39,9 +39,9 @@ namespace StardewModdingAPI.Framework.ModHelpers /// The mod using this instance. /// The friendly mod name for use in errors. /// The game content manager used for map tilesheets not provided by the mod. - /// A case-insensitive lookup of relative paths within the . + /// A lookup for relative paths within the . /// Simplifies access to private code. - public ModContentHelper(ContentCoordinator contentCore, string modFolderPath, IModMetadata mod, string modName, IContentManager gameContentManager, CaseInsensitivePathLookup relativePathCache, Reflector reflection) + public ModContentHelper(ContentCoordinator contentCore, string modFolderPath, IModMetadata mod, string modName, IContentManager gameContentManager, IFilePathLookup relativePathLookup, Reflector reflection) : base(mod) { string managedAssetPrefix = contentCore.GetManagedAssetPrefix(mod.Manifest.UniqueID); @@ -49,7 +49,7 @@ namespace StardewModdingAPI.Framework.ModHelpers this.ContentCore = contentCore; this.ModContentManager = contentCore.CreateModContentManager(managedAssetPrefix, modName, modFolderPath, gameContentManager); this.ModName = modName; - this.RelativePathCache = relativePathCache; + this.RelativePathLookup = relativePathLookup; this.Reflection = reflection; } @@ -57,7 +57,7 @@ namespace StardewModdingAPI.Framework.ModHelpers public T Load(string relativePath) where T : notnull { - relativePath = this.RelativePathCache.GetAssetName(relativePath); + relativePath = this.RelativePathLookup.GetAssetName(relativePath); IAssetName assetName = this.ContentCore.ParseAssetName(relativePath, allowLocales: false); @@ -74,7 +74,7 @@ namespace StardewModdingAPI.Framework.ModHelpers /// public IAssetName GetInternalAssetName(string relativePath) { - relativePath = this.RelativePathCache.GetAssetName(relativePath); + relativePath = this.RelativePathLookup.GetAssetName(relativePath); return this.ModContentManager.GetInternalAssetKey(relativePath); } @@ -86,7 +86,7 @@ namespace StardewModdingAPI.Framework.ModHelpers throw new ArgumentNullException(nameof(data), "Can't get a patch helper for a null value."); relativePath = relativePath != null - ? this.RelativePathCache.GetAssetName(relativePath) + ? this.RelativePathLookup.GetAssetName(relativePath) : $"temp/{Guid.NewGuid():N}"; return new AssetDataForObject( -- cgit