Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default install_to to GameData/Mods for KSP2 #3861

Merged
merged 1 commit into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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