diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-08-29 18:25:45 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-08-29 18:25:45 -0400 |
commit | e0838a28c045939b497455217bd297e8052d11ee (patch) | |
tree | 1283afab68c42fd1f426dfdf363c9d0e473f72cc /src/SMAPI/Framework/ModLoading | |
parent | a1bc96d365dc40275f198668d3f4c09bd7a92613 (diff) | |
parent | 8b6c732d7168edacf44d4dbabd8613f2c38ebc19 (diff) | |
download | SMAPI-e0838a28c045939b497455217bd297e8052d11ee.tar.gz SMAPI-e0838a28c045939b497455217bd297e8052d11ee.tar.bz2 SMAPI-e0838a28c045939b497455217bd297e8052d11ee.zip |
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI/Framework/ModLoading')
-rw-r--r-- | src/SMAPI/Framework/ModLoading/ModFailReason.cs | 8 | ||||
-rw-r--r-- | src/SMAPI/Framework/ModLoading/ModResolver.cs | 15 |
2 files changed, 19 insertions, 4 deletions
diff --git a/src/SMAPI/Framework/ModLoading/ModFailReason.cs b/src/SMAPI/Framework/ModLoading/ModFailReason.cs index cd4623e7..cfb76a33 100644 --- a/src/SMAPI/Framework/ModLoading/ModFailReason.cs +++ b/src/SMAPI/Framework/ModLoading/ModFailReason.cs @@ -9,6 +9,9 @@ namespace StardewModdingAPI.Framework.ModLoading /// <summary>Multiple copies of the mod are installed.</summary> Duplicate, + /// <summary>The folder is empty or contains only ignored files.</summary> + EmptyFolder, + /// <summary>The mod has incompatible code instructions, needs a newer SMAPI version, or is marked 'assume broken' in the SMAPI metadata list.</summary> Incompatible, @@ -22,6 +25,9 @@ namespace StardewModdingAPI.Framework.ModLoading MissingDependencies, /// <summary>The mod is marked obsolete in the SMAPI metadata list.</summary> - Obsolete + Obsolete, + + /// <summary>The folder is an XNB mod, which can't be loaded through SMAPI.</summary> + XnbMod } } diff --git a/src/SMAPI/Framework/ModLoading/ModResolver.cs b/src/SMAPI/Framework/ModLoading/ModResolver.cs index c5648c74..fe56f4d2 100644 --- a/src/SMAPI/Framework/ModLoading/ModResolver.cs +++ b/src/SMAPI/Framework/ModLoading/ModResolver.cs @@ -48,7 +48,16 @@ namespace StardewModdingAPI.Framework.ModLoading if (shouldIgnore) metadata.SetStatus(status, ModFailReason.DisabledByDotConvention, "disabled by dot convention"); else if (status == ModMetadataStatus.Failed) - metadata.SetStatus(status, ModFailReason.InvalidManifest, folder.ManifestParseErrorText); + { + ModFailReason reason = folder.ManifestParseError switch + { + ModParseError.EmptyFolder or ModParseError.EmptyVortexFolder => ModFailReason.EmptyFolder, + ModParseError.XnbMod => ModFailReason.XnbMod, + _ => ModFailReason.InvalidManifest + }; + + metadata.SetStatus(status, reason, folder.ManifestParseErrorText); + } yield return metadata; } @@ -218,12 +227,12 @@ namespace StardewModdingAPI.Framework.ModLoading { var duplicatesByID = mods .GroupBy(mod => mod.Manifest?.UniqueID?.Trim(), mod => mod, StringComparer.OrdinalIgnoreCase) - .Where(p => p.Count() > 1); + .Where(p => !string.IsNullOrEmpty(p.Key) && p.Count() > 1); foreach (var group in duplicatesByID) { foreach (IModMetadata mod in group) { - if (mod.Status == ModMetadataStatus.Failed && mod.FailReason != ModFailReason.InvalidManifest) + if (mod.Status == ModMetadataStatus.Failed && mod.FailReason is not (ModFailReason.InvalidManifest or ModFailReason.LoadFailed or ModFailReason.MissingDependencies)) continue; string folderList = string.Join(", ", group.Select(p => p.GetRelativePathWithRoot()).OrderBy(p => p)); |