Minor fixes

This commit is contained in:
2026-09-06 04:35:49 +02:00
parent 106e22b953
commit 4795116695
6 changed files with 20 additions and 13 deletions
+5 -2
View File
@@ -11,8 +11,11 @@ async function isJavaInstalledAndCompatibleFor(mcVersion, customExec = "java") {
return isJavaCompatible
}
async function installJava(component, majorVersion, customInstallPath = null) {
const installationPath = await sysinfo.determineInstallationPath(component, majorVersion, customInstallPath)
async function installJava(mcVersion, customExec = null) {
const versionManifest = await web.getVersionManifest(mcVersion)
const requiredComponent = await web.getRequiredJREFor(versionManifest)
const { component, majorVersion } = requiredComponent
const installationPath = await sysinfo.determineInstallationPath(component, majorVersion, customExec)
const requiredComponentDetails = await web.getJREComponentDetails(component, sysinfo.getPlatformKey())
const requiredComponentManifest = await web.getJREComponentManifest(requiredComponentDetails[0].manifest.url)
return await installer.downloadJavaComponent(requiredComponentManifest, installationPath)
+2 -2
View File
@@ -1,11 +1,11 @@
{
"name": "minecraft-java-manager",
"name": "@azures04/minecraft-java-manager",
"version": "0.0.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "minecraft-java-manager",
"name": "@azures04/minecraft-java-manager",
"version": "0.0.1",
"license": "MIT"
}
+10 -6
View File
@@ -1,17 +1,21 @@
{
"name": "minecraft-java-manager",
"name": "@azures04/minecraft-java-manager",
"version": "0.0.1",
"description": "Node module to check if java is installed and install it",
"keywords": [
"java",
"mclauncher",
"mc-launcher",
"minecraft-launcher",
"javainstaller",
"java-installer"
],
"repository": {
"type": "git",
"url": "https://gitea.azures.fr/azures04/minecraft-java-manager"
},
"license": "MIT",
"author": {
"name": "azures04",
"url": "https://gitea.azures.fr",
"email": "azures04@azures.fr"
},
"author": "azures04 <azures04@azures.fr> (https://gitea.azures.fr)",
"type": "commonjs",
"main": "index.js",
"scripts": {
+1 -1
View File
@@ -239,7 +239,7 @@ async function downloadJavaComponent(manifest, outputRoot, options) {
})
}
return emitter
return { events: emitter, path: outputRoot }
}
module.exports = {
+1 -1
View File
@@ -49,7 +49,7 @@ async function determineInstallationPath(component, majorVersion, customInstallP
}
switch (process.platform) {
case "win32":
return path.join("Program files", "Java", component, majorVersion)
return path.join("C:", "Program files", "Java", component, majorVersion.toString())
case "linux":
return path.join("opt", "java", component, majorVersion)
case "macos":
+1 -1
View File
@@ -1,7 +1,7 @@
const lib = require("./index")
async function main() {
await lib.installJava("jre-legacy", 8, "./java")
await lib.installJava("1.7.10")
}
main()