summaryrefslogtreecommitdiff
path: root/src/SMAPI.Toolkit/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI.Toolkit/Framework')
-rw-r--r--src/SMAPI.Toolkit/Framework/Clients/Wiki/ChangeDescriptor.cs7
-rw-r--r--src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs33
2 files changed, 23 insertions, 17 deletions
diff --git a/src/SMAPI.Toolkit/Framework/Clients/Wiki/ChangeDescriptor.cs b/src/SMAPI.Toolkit/Framework/Clients/Wiki/ChangeDescriptor.cs
index 8646f1cc..a2497dea 100644
--- a/src/SMAPI.Toolkit/Framework/Clients/Wiki/ChangeDescriptor.cs
+++ b/src/SMAPI.Toolkit/Framework/Clients/Wiki/ChangeDescriptor.cs
@@ -55,7 +55,12 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki
{
// get list
List<string> values = !string.IsNullOrWhiteSpace(rawField)
- ? new List<string>(rawField.Split(','))
+ ? new List<string>(
+ from field in rawField.Split(',')
+ let value = field.Trim()
+ where value.Length > 0
+ select value
+ )
: new List<string>();
// apply changes
diff --git a/src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs b/src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs
index 12333c4e..24485620 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
{
@@ -249,24 +250,24 @@ namespace StardewModdingAPI.Toolkit.Framework.ModScanning
/// <param name="folder">The folder to search.</param>
private FileInfo? FindManifest(DirectoryInfo folder)
{
- while (true)
- {
- // check for manifest in current folder
- FileInfo file = new(Path.Combine(folder.FullName, "manifest.json"));
- 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>