log error if mod files are detected directly under Mods folder

This commit is contained in:
Jesse Plamondon-Willard 2022-08-16 22:03:21 -04:00
parent 4d9384b828
commit 5ab87efaa0
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
2 changed files with 8 additions and 0 deletions

View File

@ -9,6 +9,7 @@
## Upcoming release
* For players:
* Added error message if mod files are detected directly under `Mods` (instead of each mod having its own subfolder).
* SMAPI now sets a success/error code when the game exits.
_This is used by your OS (like Windows) to decide whether to keep the console window open when the game ends._
* Fixed SMAPI on Windows applying different DPI awareness settings than the game (thanks to spacechase0!).

View File

@ -405,7 +405,14 @@ namespace StardewModdingAPI.Framework
{
string[] looseFiles = new DirectoryInfo(this.ModsPath).GetFiles().Select(p => p.Name).ToArray();
if (looseFiles.Any())
{
if (looseFiles.Any(name => name.Equals("manifest.json", StringComparison.OrdinalIgnoreCase) || name.EndsWith(".dll", StringComparison.OrdinalIgnoreCase)))
{
this.Monitor.Log($"Detected mod files directly inside the '{Path.GetFileName(this.ModsPath)}' folder. These will be ignored. Each mod must have its own subfolder instead.", LogLevel.Error);
}
this.Monitor.Log($" Ignored loose files: {string.Join(", ", looseFiles.OrderBy(p => p, StringComparer.OrdinalIgnoreCase))}");
}
}
// load manifests