From 1d5017f1197862d0d9c9f7aa4e13216cad3746d6 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 24 Aug 2022 17:49:12 -0400 Subject: fix broken mods with no ID listed as duplicate --- src/SMAPI/Framework/ModLoading/ModResolver.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/SMAPI/Framework/ModLoading') diff --git a/src/SMAPI/Framework/ModLoading/ModResolver.cs b/src/SMAPI/Framework/ModLoading/ModResolver.cs index c5648c74..5f1fbe4b 100644 --- a/src/SMAPI/Framework/ModLoading/ModResolver.cs +++ b/src/SMAPI/Framework/ModLoading/ModResolver.cs @@ -218,12 +218,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)); -- cgit From c2f474bf88a43e293d28851785a57a9ca1e60f2e Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 24 Aug 2022 17:49:17 -0400 Subject: distinguish empty/XNB folders from invalid manifest for error-tracking --- src/SMAPI/Framework/ModLoading/ModFailReason.cs | 8 +++++++- src/SMAPI/Framework/ModLoading/ModResolver.cs | 11 ++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'src/SMAPI/Framework/ModLoading') 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 /// Multiple copies of the mod are installed. Duplicate, + /// The folder is empty or contains only ignored files. + EmptyFolder, + /// The mod has incompatible code instructions, needs a newer SMAPI version, or is marked 'assume broken' in the SMAPI metadata list. Incompatible, @@ -22,6 +25,9 @@ namespace StardewModdingAPI.Framework.ModLoading MissingDependencies, /// The mod is marked obsolete in the SMAPI metadata list. - Obsolete + Obsolete, + + /// The folder is an XNB mod, which can't be loaded through SMAPI. + XnbMod } } diff --git a/src/SMAPI/Framework/ModLoading/ModResolver.cs b/src/SMAPI/Framework/ModLoading/ModResolver.cs index 5f1fbe4b..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; } -- cgit