diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-02-24 17:54:31 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-02-24 17:54:31 -0500 |
commit | 414cf5c197b5b59776d3dda914eb15710efb0868 (patch) | |
tree | 0393a95194ad78cf4440c68657b0488b7db6d68b /src/SMAPI/Framework/Content/ContentCache.cs | |
parent | 5da8b707385b9851ff3f6442de58519125f5c96f (diff) | |
parent | f2e8450706d1971d774f870081deffdb0c6b92eb (diff) | |
download | SMAPI-414cf5c197b5b59776d3dda914eb15710efb0868.tar.gz SMAPI-414cf5c197b5b59776d3dda914eb15710efb0868.tar.bz2 SMAPI-414cf5c197b5b59776d3dda914eb15710efb0868.zip |
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI/Framework/Content/ContentCache.cs')
-rw-r--r-- | src/SMAPI/Framework/Content/ContentCache.cs | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/src/SMAPI/Framework/Content/ContentCache.cs b/src/SMAPI/Framework/Content/ContentCache.cs index 4508e641..533da398 100644 --- a/src/SMAPI/Framework/Content/ContentCache.cs +++ b/src/SMAPI/Framework/Content/ContentCache.cs @@ -5,6 +5,7 @@ using System.Linq; using Microsoft.Xna.Framework; using StardewModdingAPI.Framework.ModLoading; using StardewModdingAPI.Framework.Reflection; +using StardewModdingAPI.Framework.Utilities; using StardewValley; namespace StardewModdingAPI.Framework.Content @@ -18,12 +19,6 @@ namespace StardewModdingAPI.Framework.Content /// <summary>The underlying asset cache.</summary> private readonly IDictionary<string, object> Cache; - /// <summary>The possible directory separator characters in an asset key.</summary> - private readonly char[] PossiblePathSeparators; - - /// <summary>The preferred directory separator chaeacter in an asset key.</summary> - private readonly string PreferredPathSeparator; - /// <summary>Applies platform-specific asset key normalisation so it's consistent with the underlying cache.</summary> private readonly Func<string, string> NormaliseAssetNameForPlatform; @@ -52,14 +47,10 @@ namespace StardewModdingAPI.Framework.Content /// <summary>Construct an instance.</summary> /// <param name="contentManager">The underlying content manager whose cache to manage.</param> /// <param name="reflection">Simplifies access to private game code.</param> - /// <param name="possiblePathSeparators">The possible directory separator characters in an asset key.</param> - /// <param name="preferredPathSeparator">The preferred directory separator chaeacter in an asset key.</param> - public ContentCache(LocalizedContentManager contentManager, Reflector reflection, char[] possiblePathSeparators, string preferredPathSeparator) + public ContentCache(LocalizedContentManager contentManager, Reflector reflection) { // init this.Cache = reflection.GetField<Dictionary<string, object>>(contentManager, "loadedAssets").GetValue(); - this.PossiblePathSeparators = possiblePathSeparators; - this.PreferredPathSeparator = preferredPathSeparator; // get key normalisation logic if (Constants.TargetPlatform == Platform.Windows) @@ -90,11 +81,7 @@ namespace StardewModdingAPI.Framework.Content [Pure] public string NormalisePathSeparators(string path) { - string[] parts = path.Split(this.PossiblePathSeparators, StringSplitOptions.RemoveEmptyEntries); - string normalised = string.Join(this.PreferredPathSeparator, parts); - if (path.StartsWith(this.PreferredPathSeparator)) - normalised = this.PreferredPathSeparator + normalised; // keep root slash - return normalised; + return PathUtilities.NormalisePathSeparators(path); } /// <summary>Normalise a cache key so it's consistent with the underlying cache.</summary> |