diff options
-rw-r--r-- | docs/release-notes.md | 11 | ||||
-rw-r--r-- | src/SMAPI/Framework/ModLoading/ModResolver.cs | 12 | ||||
-rw-r--r-- | src/SMAPI/Program.cs | 10 |
3 files changed, 22 insertions, 11 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md index 1b06f86f..f371e5d4 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -1,20 +1,19 @@ # Release notes ## 2.2 * For players: - * Fixed mods crashing when loading a custom asset on Linux/Mac. - * Fixed rare installer errors on Mac due to generated `mcs` file. + * Fixed error when a mod loads custom assets on Linux/Mac. + * Fixed error when a mod has an invalid `EntryDLL` manifest value format. + * Fixed rare error when Mac adds an `mcs` file to the installer package. * Fixed `player_add` command not handling tool upgrade levels. * Updated compatibility list. + * (log.smapi.io) Saved logs no longer expire after a week. + * (log.smapi.io) The upload-log modal can now be closed by pressing `ESC` or clicking outside it. * For modders: * Added `DaysSinceStart` property to `SDate` dates. * Fixed input `e.SuppressButton(button)` method ignoring input. * Fixed input `e.SuppressButton()` method not working with mouse buttons. -* For log.smapi.io: - * Saved logs no longer expire after a week. - * The upload-log modal can now be closed by pressing `ESC` or clicking outside it. - ## 2.1 * For players: * Added a log parser at [log.smapi.io](https://log.smapi.io). diff --git a/src/SMAPI/Framework/ModLoading/ModResolver.cs b/src/SMAPI/Framework/ModLoading/ModResolver.cs index d0ef1b08..9802d9e9 100644 --- a/src/SMAPI/Framework/ModLoading/ModResolver.cs +++ b/src/SMAPI/Framework/ModLoading/ModResolver.cs @@ -142,6 +142,18 @@ namespace StardewModdingAPI.Framework.ModLoading continue; } + // validate DLL value + if (string.IsNullOrWhiteSpace(mod.Manifest.EntryDll)) + { + mod.SetStatus(ModMetadataStatus.Failed, "its manifest has no EntryDLL field."); + continue; + } + if (mod.Manifest.EntryDll.Intersect(Path.GetInvalidFileNameChars()).Any()) + { + mod.SetStatus(ModMetadataStatus.Failed, $"its manifest has invalid filename '{mod.Manifest.EntryDll}' for the EntryDLL field."); + continue; + } + // validate DLL path string assemblyPath = Path.Combine(mod.DirectoryPath, mod.Manifest.EntryDll); if (!File.Exists(assemblyPath)) diff --git a/src/SMAPI/Program.cs b/src/SMAPI/Program.cs index b742467b..3ba35e43 100644 --- a/src/SMAPI/Program.cs +++ b/src/SMAPI/Program.cs @@ -653,11 +653,8 @@ namespace StardewModdingAPI { // get basic info IManifest manifest = metadata.Manifest; - string assemblyPath = metadata.Manifest?.EntryDll != null - ? Path.Combine(metadata.DirectoryPath, metadata.Manifest.EntryDll) - : null; - this.Monitor.Log(assemblyPath != null - ? $"Loading {metadata.DisplayName} from {assemblyPath.Replace(Constants.ModPath, "").TrimStart(Path.DirectorySeparatorChar)}..." + this.Monitor.Log(metadata.Manifest?.EntryDll != null + ? $"Loading {metadata.DisplayName} from {metadata.DirectoryPath.Replace(Constants.ModPath, "").TrimStart(Path.DirectorySeparatorChar)}{Path.DirectorySeparatorChar}{metadata.Manifest.EntryDll}..." // don't use Path.Combine here, since EntryDLL might not be valid : $"Loading {metadata.DisplayName}...", LogLevel.Trace); // validate status @@ -669,6 +666,9 @@ namespace StardewModdingAPI } // preprocess & load mod assembly + string assemblyPath = metadata.Manifest?.EntryDll != null + ? Path.Combine(metadata.DirectoryPath, metadata.Manifest.EntryDll) + : null; Assembly modAssembly; try { |