diff --git a/extensions/games/game-kerbalspaceprogram/package.json b/extensions/games/game-kerbalspaceprogram/package.json index 1e806f7490..94cd1309e9 100644 --- a/extensions/games/game-kerbalspaceprogram/package.json +++ b/extensions/games/game-kerbalspaceprogram/package.json @@ -1,6 +1,6 @@ { "name": "game-kerbalspaceprogram", - "version": "1.0.2", + "version": "1.0.3", "description": "Support for Kerbal Space Program", "scripts": { "_assets": "copyfiles -u 1 -f ./assets/* dist", diff --git a/extensions/games/game-kerbalspaceprogram/src/index.js b/extensions/games/game-kerbalspaceprogram/src/index.js index 7e0e161ac9..824c3c4be0 100644 --- a/extensions/games/game-kerbalspaceprogram/src/index.js +++ b/extensions/games/game-kerbalspaceprogram/src/index.js @@ -2,7 +2,21 @@ const Promise = require("bluebird"); const path = require("path"); const { fs, log, selectors, util } = require("@nexusmods/vortex-api"); -const extension = process.platform == "linux" ? ".x86_64" : "_x64.exe"; +const WINDOWS_EXEC = "KSP_x64.exe"; +const LINUX_EXEC = "KSP.x86_64"; + +function gameExecutable(discoveryPath) { + if (process.platform === "win32") { + return WINDOWS_EXEC; + } + // the Windows build can be installed too, to run through Proton + try { + fs.statSync(path.join(discoveryPath, WINDOWS_EXEC)); + return WINDOWS_EXEC; + } catch { + return LINUX_EXEC; + } +} function findGame() { return util.GameStoreHelper.findByAppId("220200", "steam").then((game) => game.gamePath); @@ -16,8 +30,8 @@ function main(context) { queryPath: findGame, queryModPath: () => "GameData", logo: "gameart.jpg", - executable: () => "KSP" + extension, - requiredFiles: ["KSP" + extension], + executable: gameExecutable, + requiredFiles: [path.join("GameData", "Squad")], environment: { SteamAPPId: "220200", },