Skip to content

Commit

Permalink
Merge #3861 Default install_to to GameData/Mods for KSP2
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Jul 21, 2023
2 parents 4734804 + 1238155 commit ddeac64
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 10 additions & 1 deletion CKAN.schema
Original file line number Diff line number Diff line change
Expand Up @@ -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$"
}
]
},
Expand Down
7 changes: 6 additions & 1 deletion Core/Games/KerbalSpaceProgram2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -115,6 +115,8 @@ public string PrimaryModDirectory(GameInstance inst)

public string[] CreateableDirs => new string[]
{
"GameData",
"GameData/Mods",
"BepInEx",
"BepInEx/plugins",
};
Expand Down Expand Up @@ -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<string, string> allowedFolders = new Dictionary<string, string>
{
{ "BepInEx", "BepInEx" },
Expand Down
2 changes: 1 addition & 1 deletion Spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`).
Expand Down

0 comments on commit ddeac64

Please sign in to comment.