summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/SMAPI.ModBuildConfig/DeployModTask.cs2
-rw-r--r--src/SMAPI.ModBuildConfig/Framework/ModFileManager.cs23
2 files changed, 15 insertions, 10 deletions
diff --git a/src/SMAPI.ModBuildConfig/DeployModTask.cs b/src/SMAPI.ModBuildConfig/DeployModTask.cs
index 73971279..96d95e06 100644
--- a/src/SMAPI.ModBuildConfig/DeployModTask.cs
+++ b/src/SMAPI.ModBuildConfig/DeployModTask.cs
@@ -64,7 +64,7 @@ namespace StardewModdingAPI.ModBuildConfig
Regex[] ignoreFilePatterns = this.GetCustomIgnorePatterns().ToArray();
// get mod info
- ModFileManager package = new ModFileManager(this.ProjectDir, this.TargetDir, ignoreFilePatterns);
+ ModFileManager package = new ModFileManager(this.ProjectDir, this.TargetDir, ignoreFilePatterns, validateRequiredModFiles: this.EnableModDeploy || this.EnableModZip);
// deploy mod files
if (this.EnableModDeploy)
diff --git a/src/SMAPI.ModBuildConfig/Framework/ModFileManager.cs b/src/SMAPI.ModBuildConfig/Framework/ModFileManager.cs
index 524aeaf7..f4738d71 100644
--- a/src/SMAPI.ModBuildConfig/Framework/ModFileManager.cs
+++ b/src/SMAPI.ModBuildConfig/Framework/ModFileManager.cs
@@ -28,8 +28,9 @@ namespace StardewModdingAPI.ModBuildConfig.Framework
/// <param name="projectDir">The folder containing the project files.</param>
/// <param name="targetDir">The folder containing the build output.</param>
/// <param name="ignoreFilePatterns">Custom regex patterns matching files to ignore when deploying or zipping the mod.</param>
+ /// <param name="validateRequiredModFiles">Whether to validate that required mod files like the manifest are present.</param>
/// <exception cref="UserErrorException">The mod package isn't valid.</exception>
- public ModFileManager(string projectDir, string targetDir, Regex[] ignoreFilePatterns)
+ public ModFileManager(string projectDir, string targetDir, Regex[] ignoreFilePatterns, bool validateRequiredModFiles)
{
this.Files = new Dictionary<string, FileInfo>(StringComparer.InvariantCultureIgnoreCase);
@@ -82,14 +83,18 @@ namespace StardewModdingAPI.ModBuildConfig.Framework
this.Files[relativePath] = file;
}
- // check for missing manifest
- if (!this.Files.ContainsKey(this.ManifestFileName))
- throw new UserErrorException($"Could not create mod package because no {this.ManifestFileName} was found in the project or build output.");
-
- // check for missing DLL
- // ReSharper disable once SimplifyLinqExpression
- if (!this.Files.Any(p => !p.Key.EndsWith(".dll")))
- throw new UserErrorException("Could not create mod package because no .dll file was found in the project or build output.");
+ // check for required files
+ if (validateRequiredModFiles)
+ {
+ // manifest
+ if (!this.Files.ContainsKey(this.ManifestFileName))
+ throw new UserErrorException($"Could not create mod package because no {this.ManifestFileName} was found in the project or build output.");
+
+ // DLL
+ // ReSharper disable once SimplifyLinqExpression
+ if (!this.Files.Any(p => !p.Key.EndsWith(".dll")))
+ throw new UserErrorException("Could not create mod package because no .dll file was found in the project or build output.");
+ }
}
/// <summary>Get the files in the mod package.</summary>