From 559d763756e3ccbd7feaa3b82d7924d8cd97969f Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 16 Apr 2022 14:34:52 -0400 Subject: remove unused subfolder manifest scanning This isn't needed anymore with the current is-mod-folder scanning. --- .../Framework/ModScanning/ModScanner.cs | 43 ++++++++-------------- 1 file changed, 16 insertions(+), 27 deletions(-) (limited to 'src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs') 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 /// The folder to search. 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; } /// Get whether a given folder should be treated as a search folder (i.e. look for subfolders containing mods). -- cgit