Skip to content

Commit

Permalink
Merge #3984 Detect and use Windows KSP2 executable on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Jan 2, 2024
2 parents 7cf9d0b + ad08574 commit 65728a6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.
- [CLI] Pause after administrator error message (#3966 by: HebaruSan; reviewed: techman83)
- [Multiple] Put auto-installed mods in ignored modpack group by default (#3978 by: HebaruSan)
- [GUI] Add links to hidden tags and labels below mod list (#3979, #3980 by: HebaruSan)
- [Core] Detect and use Windows KSP2 executable on Linux (#3984 by: JackOfHertz; reviewed: HebaruSan)

### Bugfixes

Expand Down
27 changes: 20 additions & 7 deletions Core/Games/KerbalSpaceProgram2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,13 @@ public void RebuildSubdirectories(string absGameRoot)
}

public string DefaultCommandLine(string path)
=> Platform.IsUnix ? "./KSP2.x86_64 -single-instance"
: Platform.IsMac ? "./KSP2.app/Contents/MacOS/KSP"
: "KSP2_x64.exe -single-instance";
=> Platform.IsMac
? "./KSP2.app/Contents/MacOS/KSP2"
: string.Format(Platform.IsUnix ? "./{0} -single-instance"
: "{0} -single-instance",
InstanceAnchorFiles.FirstOrDefault(f =>
File.Exists(Path.Combine(path, f)))
?? InstanceAnchorFiles.First());

public string[] AdjustCommandLine(string[] args, GameVersion installedVersion)
=> args;
Expand Down Expand Up @@ -213,10 +217,19 @@ private GameVersion VersionFromFile(string path)

public string CompatibleVersionsFile => "compatible_game_versions.json";

public string[] InstanceAnchorFiles => new string[]
{
"KSP2_x64.exe",
};
public string[] InstanceAnchorFiles =>
Platform.IsUnix
? new string[]
{
// Native Linux port, if/when it arrives
"KSP2.x86_64",
// Windows EXE via Proton on Linux
"KSP2_x64.exe",
}
: new string[]
{
"KSP2_x64.exe",
};

public Uri DefaultRepositoryURL => new Uri("https://github.com/KSP-CKAN/KSP2-CKAN-meta/archive/main.tar.gz");

Expand Down

0 comments on commit 65728a6

Please sign in to comment.