summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/SMAPI/Framework/ModLoading/ModResolver.cs12
-rw-r--r--src/SMAPI/Program.cs10
2 files changed, 17 insertions, 5 deletions
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
{