distinguish empty/XNB folders from invalid manifest for error-tracking

This commit is contained in:
Jesse Plamondon-Willard 2022-08-24 17:49:17 -04:00
parent 1d5017f119
commit c2f474bf88
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
2 changed files with 17 additions and 2 deletions

View File

@ -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
}
}

View File

@ -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;
}