From e3a0bd7e29e0e05bb574786268c30ff82dcc433d Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 9 Jan 2019 22:52:40 -0500 Subject: [PATCH] deprecate entry DLL with case-insensitive match --- docs/release-notes.md | 1 + src/SMAPI/Framework/ModLoading/ModResolver.cs | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/release-notes.md b/docs/release-notes.md index 64f6368d..93e80266 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -17,6 +17,7 @@ * Fixed 'unknown mod' deprecation warnings showing the wrong stack trace. * Fixed `e.Cursor` in input events showing wrong grab tile when player using a controller moves without moving the viewpoint. * Fixed incorrect 'bypassed safety checks' warning for mods using the new `Specialised.LoadStageChanged` event in 2.10. + * Deprecated `EntryDll` values whose capitalisation don't match the actual file. (This works on Windows, but causes errors for Linux/Mac players.) ## 2.10.1 Released 30 December 2018 for Stardew Valley 1.3.32. diff --git a/src/SMAPI/Framework/ModLoading/ModResolver.cs b/src/SMAPI/Framework/ModLoading/ModResolver.cs index 835b0a54..a8564524 100644 --- a/src/SMAPI/Framework/ModLoading/ModResolver.cs +++ b/src/SMAPI/Framework/ModLoading/ModResolver.cs @@ -137,12 +137,23 @@ namespace StardewModdingAPI.Framework.ModLoading } // invalid path - string assemblyPath = Path.Combine(mod.DirectoryPath, mod.Manifest.EntryDll); - if (!File.Exists(assemblyPath)) + if (!File.Exists(Path.Combine(mod.DirectoryPath, mod.Manifest.EntryDll))) { mod.SetStatus(ModMetadataStatus.Failed, $"its DLL '{mod.Manifest.EntryDll}' doesn't exist."); continue; } + + // invalid capitalisation + string actualFilename = new DirectoryInfo(mod.DirectoryPath).GetFiles(mod.Manifest.EntryDll).FirstOrDefault()?.Name; + if (actualFilename != mod.Manifest.EntryDll) + { +#if SMAPI_3_0_STRICT + mod.SetStatus(ModMetadataStatus.Failed, $"its {nameof(IManifest.EntryDll)} value '{mod.Manifest.EntryDll}' doesn't match the actual file capitalisation '{actualFilename}'. The capitalisation must match for crossplatform compatibility."); + continue; +#else + SCore.DeprecationManager.Warn(mod.DisplayName, $"{nameof(IManifest.EntryDll)} value with case-insensitive capitalisation", "2.11", DeprecationLevel.Info); +#endif + } } // validate content pack