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/ContentManagers/ModContentManager.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/SMAPI/Framework/ContentManagers') diff --git a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs index 8f64c5a8..91de769f 100644 --- a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs +++ b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs @@ -10,6 +10,7 @@ using StardewModdingAPI.Framework.Exceptions; using StardewModdingAPI.Framework.Reflection; using StardewModdingAPI.Toolkit.Serialization; using StardewModdingAPI.Toolkit.Utilities; +using StardewModdingAPI.Toolkit.Utilities.PathLookups; using StardewValley; using xTile; using xTile.Format; @@ -32,8 +33,8 @@ namespace StardewModdingAPI.Framework.ContentManagers /// The game content manager used for map tilesheets not provided by the mod. private readonly IContentManager GameContentManager; - /// A case-insensitive lookup of relative paths within the . - private readonly CaseInsensitivePathLookup RelativePathCache; + /// A lookup for relative paths within the . + private readonly IFilePathLookup RelativePathLookup; /// If a map tilesheet's image source has no file extensions, the file extensions to check for in the local mod folder. private readonly string[] LocalTilesheetExtensions = { ".png", ".xnb" }; @@ -55,12 +56,12 @@ namespace StardewModdingAPI.Framework.ContentManagers /// Encapsulates SMAPI's JSON file parsing. /// A callback to invoke when the content manager is being disposed. /// Whether to enable more aggressive memory optimizations. - /// A case-insensitive lookup of relative paths within the . - public ModContentManager(string name, IContentManager gameContentManager, IServiceProvider serviceProvider, string modName, string rootDirectory, CultureInfo currentCulture, ContentCoordinator coordinator, IMonitor monitor, Reflector reflection, JsonHelper jsonHelper, Action onDisposing, bool aggressiveMemoryOptimizations, CaseInsensitivePathLookup relativePathCache) + /// A lookup for relative paths within the . + public ModContentManager(string name, IContentManager gameContentManager, IServiceProvider serviceProvider, string modName, string rootDirectory, CultureInfo currentCulture, ContentCoordinator coordinator, IMonitor monitor, Reflector reflection, JsonHelper jsonHelper, Action onDisposing, bool aggressiveMemoryOptimizations, IFilePathLookup relativePathLookup) : base(name, serviceProvider, rootDirectory, currentCulture, coordinator, monitor, reflection, onDisposing, isNamespaced: true, aggressiveMemoryOptimizations: aggressiveMemoryOptimizations) { this.GameContentManager = gameContentManager; - this.RelativePathCache = relativePathCache; + this.RelativePathLookup = relativePathLookup; this.JsonHelper = jsonHelper; this.ModName = modName; @@ -257,7 +258,7 @@ namespace StardewModdingAPI.Framework.ContentManagers private FileInfo GetModFile(string path) { // map to case-insensitive path if needed - path = this.RelativePathCache.GetFilePath(path); + path = this.RelativePathLookup.GetFilePath(path); // try exact match FileInfo file = new(Path.Combine(this.FullRootDirectory, path)); -- cgit