diff --git a/CHANGELOG.md b/CHANGELOG.md index f81f899f03..3d13b176ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file. - [GUI] Installation history tab (#3834 by: HebaruSan; reviewed: techman83) - [GUI] Hide fake instance creation in GUI (#3839 by: HebaruSan; reviewed: techman83) - [GUI] Tooltip for auto-installed checkboxes (#3842 by: HebaruSan; reviewed: techman83) +- [Core] Default `install_to` to GameData/Mods for KSP2 (#3861 by: HebaruSan; reviewed: techman83) ### Bugfixes diff --git a/CKAN.schema b/CKAN.schema index 83d90a0e9f..cef4795c06 100644 --- a/CKAN.schema +++ b/CKAN.schema @@ -445,10 +445,19 @@ "type" : "string", "pattern" : "^Missions" }, + { + "description" : "KSP2 default mods folder", + "enum" : [ "GameData/Mods" ] + }, + { + "description" : "KSP2 default mods folder with subfolder", + "type" : "string", + "pattern" : "^GameData/Mods/" + }, { "description" : "KSP2 BepInEx plugins folder", "type" : "string", - "pattern" : "BepInEx/plugins" + "pattern" : "^BepInEx/plugins$" } ] }, diff --git a/Core/Games/KerbalSpaceProgram2.cs b/Core/Games/KerbalSpaceProgram2.cs index 511bb7507c..fe699f7423 100644 --- a/Core/Games/KerbalSpaceProgram2.cs +++ b/Core/Games/KerbalSpaceProgram2.cs @@ -96,7 +96,7 @@ public string MacPath() return null; } - public string PrimaryModDirectoryRelative => "BepInEx/plugins"; + public string PrimaryModDirectoryRelative => "GameData/Mods"; public string PrimaryModDirectory(GameInstance inst) => CKANPathUtils.NormalizePath( @@ -115,6 +115,8 @@ public string PrimaryModDirectory(GameInstance inst) public string[] CreateableDirs => new string[] { + "GameData", + "GameData/Mods", "BepInEx", "BepInEx/plugins", }; @@ -200,6 +202,9 @@ private GameVersion VersionFromFile(string path) public Uri RepositoryListURL => new Uri("https://raw.githubusercontent.com/KSP-CKAN/KSP2-CKAN-meta/main/repositories.json"); + // Key: Allowed value of install_to + // Value: Relative path + // (PrimaryModDirectoryRelative is allowed implicitly) private readonly Dictionary allowedFolders = new Dictionary { { "BepInEx", "BepInEx" }, diff --git a/Spec.md b/Spec.md index c26ec17ac1..3e800e8586 100644 --- a/Spec.md +++ b/Spec.md @@ -295,7 +295,7 @@ In addition a destination directive *must* be provided: - `install_to`: The target location where the matched file or directory should be installed. - Valid values for this entry for KSP1 mods are `GameData`, `Missions`(**v1.25**), `Ships`, `Ships/SPH`(**v1.12**), `Ships/VAB`(**v1.12**), `Ships/@thumbs/VAB`(**v1.16**), `Ships/@thumbs/SPH`(**v1.16**), `Ships/Script`(**v1.29**), `Tutorial`, `Scenarios` (**v1.14**), and `GameRoot` (which should be used sparingly, if at all). - - Valid values for this entry for KSP2 mods are `GameRoot` and `BepInEx/plugins` (**v1.32**) + - Valid values for this entry for KSP2 mods are `GameRoot`, `BepInEx/plugins` (**v1.32**), and `GameData/Mods` (**v1.33**) - A path to a given subfolder location can be specified *only* under `GameData` (**v1.2**); for example: `GameData/MyMod/Plugins`. The client *must* check this path and abort the install if any attempts to traverse up directories are found (eg: `GameData/../Example`).