summaryrefslogtreecommitdiff
path: root/src/SMAPI.Toolkit/Utilities
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-04-16 14:28:20 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-04-16 14:28:20 -0400
commitf93c41f55c199293b4b8e00fc38ab89d24837f03 (patch)
treecef85a1362e5d585940f2655c1c1e4897ad37471 /src/SMAPI.Toolkit/Utilities
parent95d7ba8935ac7214805147e694353206a56bddb7 (diff)
downloadSMAPI-f93c41f55c199293b4b8e00fc38ab89d24837f03.tar.gz
SMAPI-f93c41f55c199293b4b8e00fc38ab89d24837f03.tar.bz2
SMAPI-f93c41f55c199293b4b8e00fc38ab89d24837f03.zip
make manifest.json filename case-insensitive
Diffstat (limited to 'src/SMAPI.Toolkit/Utilities')
-rw-r--r--src/SMAPI.Toolkit/Utilities/CaseInsensitivePathLookup.cs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/SMAPI.Toolkit/Utilities/CaseInsensitivePathLookup.cs b/src/SMAPI.Toolkit/Utilities/CaseInsensitivePathLookup.cs
index 2e149e3c..12fad008 100644
--- a/src/SMAPI.Toolkit/Utilities/CaseInsensitivePathLookup.cs
+++ b/src/SMAPI.Toolkit/Utilities/CaseInsensitivePathLookup.cs
@@ -25,10 +25,11 @@ namespace StardewModdingAPI.Toolkit.Utilities
*********/
/// <summary>Construct an instance.</summary>
/// <param name="rootPath">The root directory path for relative paths.</param>
- public CaseInsensitivePathLookup(string rootPath)
+ /// <param name="searchOption">Which directories to scan from the root.</param>
+ public CaseInsensitivePathLookup(string rootPath, SearchOption searchOption = SearchOption.AllDirectories)
{
this.RootPath = rootPath;
- this.RelativePathCache = new(this.GetRelativePathCache);
+ this.RelativePathCache = new(() => this.GetRelativePathCache(searchOption));
}
/// <summary>Get the exact capitalization for a given relative file path.</summary>
@@ -108,11 +109,12 @@ namespace StardewModdingAPI.Toolkit.Utilities
}
/// <summary>Get a case-insensitive lookup of file paths (see <see cref="RelativePathCache"/>).</summary>
- private Dictionary<string, string> GetRelativePathCache()
+ /// <param name="searchOption">Which directories to scan from the root.</param>
+ private Dictionary<string, string> GetRelativePathCache(SearchOption searchOption)
{
Dictionary<string, string> cache = new(StringComparer.OrdinalIgnoreCase);
- foreach (string path in Directory.EnumerateFiles(this.RootPath, "*", SearchOption.AllDirectories))
+ foreach (string path in Directory.EnumerateFiles(this.RootPath, "*", searchOption))
{
string relativePath = path.Substring(this.RootPath.Length + 1);