This commit is contained in:
Gilles Lazures 2025-05-11 08:01:49 +02:00
parent 1106ced049
commit cd627b03ae
2 changed files with 16 additions and 1 deletions

View File

@ -448,7 +448,7 @@ async function launchGame(restartGame) {
type: "release"
},
forge: path.join(app.getPath("appData"), ".catboat", "forge-1.16.5.jar"),
javaPath: "C:\\Program Files\\Java\\jdk-17\\bin\\java.exe",
javaPath: await java.getPath(path.join(app.getPath("appData"), ".catboat", "jre")),
memory: {
min: 512,
max: launcherSettings.get("ram").max

View File

@ -74,6 +74,21 @@ async function main(customExtractPath) {
}
}
async function getPath(customExtractPath) {
const requiredVersion = "17"
const isJavaInstalled = checkJavaVersion(requiredVersion)
if (!isJavaInstalled) {
if (!fs.existsSync(path.join(customExtractPath, "jdk-17.0.12", "bin", os.platform() == "win32" ? "java.exe" : "java"))) {
await main(customExtractPath)
} else {
return path.join(customExtractPath, "jdk-17.0.12", "bin", os.platform() == "win32" ? "java.exe" : "java")
}
} else {
console.log("No further action is required.")
}
}
module.exports = {
main
}