diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-04-16 14:28:20 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-04-16 14:28:20 -0400 |
commit | f93c41f55c199293b4b8e00fc38ab89d24837f03 (patch) | |
tree | cef85a1362e5d585940f2655c1c1e4897ad37471 /src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs | |
parent | 95d7ba8935ac7214805147e694353206a56bddb7 (diff) | |
download | SMAPI-f93c41f55c199293b4b8e00fc38ab89d24837f03.tar.gz SMAPI-f93c41f55c199293b4b8e00fc38ab89d24837f03.tar.bz2 SMAPI-f93c41f55c199293b4b8e00fc38ab89d24837f03.zip |
make manifest.json filename case-insensitive
Diffstat (limited to 'src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs')
-rw-r--r-- | src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs b/src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs index 12333c4e..84329f63 100644 --- a/src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs +++ b/src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Text.RegularExpressions; using StardewModdingAPI.Toolkit.Serialization; using StardewModdingAPI.Toolkit.Serialization.Models; +using StardewModdingAPI.Toolkit.Utilities; namespace StardewModdingAPI.Toolkit.Framework.ModScanning { @@ -251,8 +252,19 @@ namespace StardewModdingAPI.Toolkit.Framework.ModScanning { while (true) { - // check for manifest in current folder - FileInfo file = new(Path.Combine(folder.FullName, "manifest.json")); + // check for conventional manifest in current folder + const string defaultName = "manifest.json"; + FileInfo file = new(Path.Combine(folder.FullName, defaultName)); + if (file.Exists) + return file; + + // check for manifest with incorrect capitalization + { + CaseInsensitivePathLookup pathLookup = new(folder.FullName, SearchOption.TopDirectoryOnly); // don't use GetCachedFor, since we only need it temporarily + string realName = pathLookup.GetFilePath(defaultName); + if (realName != defaultName) + file = new(Path.Combine(folder.FullName, realName)); + } if (file.Exists) return file; |