summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/ContentManagers
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-05-04 20:35:08 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-05-04 20:35:08 -0400
commitc1342bd4cd6b75b24d11275bdd73ebf893f916ea (patch)
tree3c647582d242cbb6abc71ae7bbbbd14c63ce6558 /src/SMAPI/Framework/ContentManagers
parent42bf82d870ab744f13197ad781b7529a959861e1 (diff)
downloadSMAPI-c1342bd4cd6b75b24d11275bdd73ebf893f916ea.tar.gz
SMAPI-c1342bd4cd6b75b24d11275bdd73ebf893f916ea.tar.bz2
SMAPI-c1342bd4cd6b75b24d11275bdd73ebf893f916ea.zip
disable case-insensitive paths by default pending performance rework
Diffstat (limited to 'src/SMAPI/Framework/ContentManagers')
-rw-r--r--src/SMAPI/Framework/ContentManagers/ModContentManager.cs13
1 files changed, 7 insertions, 6 deletions
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
/// <summary>The game content manager used for map tilesheets not provided by the mod.</summary>
private readonly IContentManager GameContentManager;
- /// <summary>A case-insensitive lookup of relative paths within the <see cref="ContentManager.RootDirectory"/>.</summary>
- private readonly CaseInsensitivePathLookup RelativePathCache;
+ /// <summary>A lookup for relative paths within the <see cref="ContentManager.RootDirectory"/>.</summary>
+ private readonly IFilePathLookup RelativePathLookup;
/// <summary>If a map tilesheet's image source has no file extensions, the file extensions to check for in the local mod folder.</summary>
private readonly string[] LocalTilesheetExtensions = { ".png", ".xnb" };
@@ -55,12 +56,12 @@ namespace StardewModdingAPI.Framework.ContentManagers
/// <param name="jsonHelper">Encapsulates SMAPI's JSON file parsing.</param>
/// <param name="onDisposing">A callback to invoke when the content manager is being disposed.</param>
/// <param name="aggressiveMemoryOptimizations">Whether to enable more aggressive memory optimizations.</param>
- /// <param name="relativePathCache">A case-insensitive lookup of relative paths within the <paramref name="rootDirectory"/>.</param>
- public ModContentManager(string name, IContentManager gameContentManager, IServiceProvider serviceProvider, string modName, string rootDirectory, CultureInfo currentCulture, ContentCoordinator coordinator, IMonitor monitor, Reflector reflection, JsonHelper jsonHelper, Action<BaseContentManager> onDisposing, bool aggressiveMemoryOptimizations, CaseInsensitivePathLookup relativePathCache)
+ /// <param name="relativePathLookup">A lookup for relative paths within the <paramref name="rootDirectory"/>.</param>
+ public ModContentManager(string name, IContentManager gameContentManager, IServiceProvider serviceProvider, string modName, string rootDirectory, CultureInfo currentCulture, ContentCoordinator coordinator, IMonitor monitor, Reflector reflection, JsonHelper jsonHelper, Action<BaseContentManager> 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));