add separate error when player puts an XNB mod in Mods
This commit is contained in:
parent
43e935b017
commit
074f730329
|
@ -5,6 +5,7 @@
|
|||
* Moved most SMAPI files into a `smapi-internal` subfolder.
|
||||
* Moved save backups into a `save-backups` subfolder (instead of `Mods/SaveBackup/backups`). Note that previous backups will be deleted when you update.
|
||||
* Update checks now work even when the mod has no update keys in most cases.
|
||||
* Improved error when you put an XNB mod in `Mods`.
|
||||
* Fixed error when mods add an invalid location with no name.
|
||||
* Fixed compatibility issues for some Linux players. SMAPI will now always use xterm if it's available.
|
||||
* Fixed some game install paths not detected on Windows.
|
||||
|
|
|
@ -24,6 +24,15 @@ namespace StardewModdingAPI.Toolkit.Framework.ModScanning
|
|||
"Thumbs.db"
|
||||
};
|
||||
|
||||
/// <summary>The extensions for files which an XNB mod may contain. If a mod contains *only* these file extensions, it should be considered an XNB mod.</summary>
|
||||
private readonly HashSet<string> PotentialXnbModExtensions = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase)
|
||||
{
|
||||
".md",
|
||||
".png",
|
||||
".txt",
|
||||
".xnb"
|
||||
};
|
||||
|
||||
|
||||
/*********
|
||||
** Public methods
|
||||
|
@ -50,11 +59,15 @@ namespace StardewModdingAPI.Toolkit.Framework.ModScanning
|
|||
{
|
||||
// find manifest.json
|
||||
FileInfo manifestFile = this.FindManifest(searchFolder);
|
||||
|
||||
// set appropriate invalid-mod error
|
||||
if (manifestFile == null)
|
||||
{
|
||||
bool isEmpty = !searchFolder.GetFileSystemInfos().Where(this.IsRelevant).Any();
|
||||
if (isEmpty)
|
||||
FileInfo[] files = searchFolder.GetFiles("*", SearchOption.AllDirectories).Where(this.IsRelevant).ToArray();
|
||||
if (!files.Any())
|
||||
return new ModFolder(root, searchFolder, null, "it's an empty folder.");
|
||||
if (files.All(file => this.PotentialXnbModExtensions.Contains(file.Extension)))
|
||||
return new ModFolder(root, searchFolder, null, "it's an older XNB mod which replaces game files (not run through SMAPI).");
|
||||
return new ModFolder(root, searchFolder, null, "it contains files, but none of them are manifest.json.");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue