summaryrefslogtreecommitdiff
path: root/src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-04-16 14:34:52 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-04-16 14:34:52 -0400
commit559d763756e3ccbd7feaa3b82d7924d8cd97969f (patch)
tree607c0f5fb457576a3982670423d105f0167e4b72 /src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs
parentf93c41f55c199293b4b8e00fc38ab89d24837f03 (diff)
downloadSMAPI-559d763756e3ccbd7feaa3b82d7924d8cd97969f.tar.gz
SMAPI-559d763756e3ccbd7feaa3b82d7924d8cd97969f.tar.bz2
SMAPI-559d763756e3ccbd7feaa3b82d7924d8cd97969f.zip
remove unused subfolder manifest scanning
This isn't needed anymore with the current is-mod-folder scanning.
Diffstat (limited to 'src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs')
-rw-r--r--src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs43
1 files changed, 16 insertions, 27 deletions
diff --git a/src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs b/src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs
index 84329f63..24485620 100644
--- a/src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs
+++ b/src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs
@@ -250,35 +250,24 @@ namespace StardewModdingAPI.Toolkit.Framework.ModScanning
/// <param name="folder">The folder to search.</param>
private FileInfo? FindManifest(DirectoryInfo folder)
{
- while (true)
- {
- // 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;
-
- // check for single subfolder
- FileSystemInfo[] entries = folder.EnumerateFileSystemInfos().Take(2).ToArray();
- if (entries.Length == 1 && entries[0] is DirectoryInfo subfolder)
- {
- folder = subfolder;
- continue;
- }
+ // 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;
- // not found
- return null;
+ // 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;
+
+ // not found
+ return null;
}
/// <summary>Get whether a given folder should be treated as a search folder (i.e. look for subfolders containing mods).</summary>