Skip to content

Commit

Permalink
Merge #3713 Fix Netkan check for Ships/Script spec_version
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Nov 21, 2022
2 parents aeb2388 + 01f68f7 commit d4055e7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Expand Up @@ -15,7 +15,8 @@ All notable changes to this project will be documented in this file.

### Internal

- [Tooling] Switch workflows from set-output to `$GITHUB_OUTPUT` (#3696 by: HebaruSan; reviewed: )
- [Tooling] Switch workflows from set-output to `$GITHUB_OUTPUT` (#3696 by: HebaruSan)
- [Netkan] Fix Netkan check for Ships/Script `spec_version` (#3713 by: HebaruSan; reviewed: techman83)

## v1.31.2 (Juno)

Expand Down
13 changes: 12 additions & 1 deletion Netkan/Validators/InstallValidator.cs
@@ -1,4 +1,7 @@
using System.Linq;

using Newtonsoft.Json.Linq;

using CKAN.Versioning;
using CKAN.NetKAN.Model;

Expand Down Expand Up @@ -30,7 +33,15 @@ public void Validate(Metadata metadata)
{
throw new Kraken("spec_version v1.25+ required to install to Missions");
}
if (metadata.SpecVersion < v1p29 && install_to.StartsWith("Ships/Script"))
if (metadata.SpecVersion < v1p29 && (
install_to.StartsWith("Ships/Script")
|| install_to.Equals("Ships") && (
// find: .../Script, install_to: Ships
((string)stanza["find"])?.Split(new char[] {'/'})?.LastOrDefault() == "Script"
// file: .../Script, install_to: Ships
|| ((string)stanza["file"])?.Split(new char[] {'/'})?.LastOrDefault() == "Script"
// install_to: Ships, as: Script
|| (((string)stanza["as"])?.EndsWith("Script") ?? false))))
{
throw new Kraken("spec_version v1.29+ required to install to Ships/Script");
}
Expand Down

0 comments on commit d4055e7

Please sign in to comment.