summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-05-13 21:38:04 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-05-13 21:38:04 -0400
commitf03b300b3fc4bcc9844e77e810dcf352a34b9232 (patch)
tree5681524ffddf56f01f479820e8a5773ba9fac7df /src/StardewModdingAPI
parent53547a8ca3a5cba45bd0a5a478d0f40daa282888 (diff)
downloadSMAPI-f03b300b3fc4bcc9844e77e810dcf352a34b9232.tar.gz
SMAPI-f03b300b3fc4bcc9844e77e810dcf352a34b9232.tar.bz2
SMAPI-f03b300b3fc4bcc9844e77e810dcf352a34b9232.zip
pass SMAPI version into metadata validation to simplify unit tests (#285)
Diffstat (limited to 'src/StardewModdingAPI')
-rw-r--r--src/StardewModdingAPI/Framework/ModLoading/ModResolver.cs7
-rw-r--r--src/StardewModdingAPI/Program.cs2
2 files changed, 5 insertions, 4 deletions
diff --git a/src/StardewModdingAPI/Framework/ModLoading/ModResolver.cs b/src/StardewModdingAPI/Framework/ModLoading/ModResolver.cs
index a3d4ce3e..e3f4fc12 100644
--- a/src/StardewModdingAPI/Framework/ModLoading/ModResolver.cs
+++ b/src/StardewModdingAPI/Framework/ModLoading/ModResolver.cs
@@ -75,7 +75,8 @@ namespace StardewModdingAPI.Framework.ModLoading
/// <summary>Validate manifest metadata.</summary>
/// <param name="mods">The mod manifests to validate.</param>
- public void ValidateManifests(IEnumerable<IModMetadata> mods)
+ /// <param name="apiVersion">The current SMAPI version.</param>
+ public void ValidateManifests(IEnumerable<IModMetadata> mods, ISemanticVersion apiVersion)
{
foreach (IModMetadata mod in mods)
{
@@ -108,10 +109,10 @@ namespace StardewModdingAPI.Framework.ModLoading
{
if (!SemanticVersion.TryParse(mod.Manifest.MinimumApiVersion, out ISemanticVersion minVersion))
{
- mod.SetStatus(ModMetadataStatus.Failed, $"it has an invalid minimum SMAPI version '{mod.Manifest.MinimumApiVersion}'. This should be a semantic version number like {Constants.ApiVersion}.");
+ mod.SetStatus(ModMetadataStatus.Failed, $"it has an invalid minimum SMAPI version '{mod.Manifest.MinimumApiVersion}'. This should be a semantic version number like {apiVersion}.");
continue;
}
- if (minVersion.IsNewerThan(Constants.ApiVersion))
+ if (minVersion.IsNewerThan(apiVersion))
{
mod.SetStatus(ModMetadataStatus.Failed, $"it needs SMAPI {minVersion} or later. Please update SMAPI to the latest version to use this mod.");
continue;
diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs
index 9ccb4ddc..743de050 100644
--- a/src/StardewModdingAPI/Program.cs
+++ b/src/StardewModdingAPI/Program.cs
@@ -318,7 +318,7 @@ namespace StardewModdingAPI
// load manifests
IModMetadata[] mods = resolver.ReadManifests(Constants.ModPath, new JsonHelper(), this.Settings.ModCompatibility).ToArray();
- resolver.ValidateManifests(mods);
+ resolver.ValidateManifests(mods, Constants.ApiVersion);
// check for deprecated metadata
IList<Action> deprecationWarnings = new List<Action>();