deprecate entry DLL with case-insensitive match

This commit is contained in:
Jesse Plamondon-Willard 2019-01-09 22:52:40 -05:00
parent 90c5858cf8
commit e3a0bd7e29
No known key found for this signature in database
GPG Key ID: 7D7C8097B62033CE
2 changed files with 14 additions and 2 deletions

View File

@ -17,6 +17,7 @@
* Fixed 'unknown mod' deprecation warnings showing the wrong stack trace. * 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 `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. * 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 ## 2.10.1
Released 30 December 2018 for Stardew Valley 1.3.32. Released 30 December 2018 for Stardew Valley 1.3.32.

View File

@ -137,12 +137,23 @@ namespace StardewModdingAPI.Framework.ModLoading
} }
// invalid path // invalid path
string assemblyPath = Path.Combine(mod.DirectoryPath, mod.Manifest.EntryDll); if (!File.Exists(Path.Combine(mod.DirectoryPath, mod.Manifest.EntryDll)))
if (!File.Exists(assemblyPath))
{ {
mod.SetStatus(ModMetadataStatus.Failed, $"its DLL '{mod.Manifest.EntryDll}' doesn't exist."); mod.SetStatus(ModMetadataStatus.Failed, $"its DLL '{mod.Manifest.EntryDll}' doesn't exist.");
continue; 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 // validate content pack