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 return isJavaCompatible
} }
async function installJava(component, majorVersion, customInstallPath = null) { async function installJava(mcVersion, customExec = null) {
const installationPath = await sysinfo.determineInstallationPath(component, majorVersion, customInstallPath) 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 requiredComponentDetails = await web.getJREComponentDetails(component, sysinfo.getPlatformKey())
const requiredComponentManifest = await web.getJREComponentManifest(requiredComponentDetails[0].manifest.url) const requiredComponentManifest = await web.getJREComponentManifest(requiredComponentDetails[0].manifest.url)
return await installer.downloadJavaComponent(requiredComponentManifest, installationPath) 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", "version": "0.0.1",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "minecraft-java-manager", "name": "@azures04/minecraft-java-manager",
"version": "0.0.1", "version": "0.0.1",
"license": "MIT" "license": "MIT"
} }
+10 -6
View File
@@ -1,17 +1,21 @@
{ {
"name": "minecraft-java-manager", "name": "@azures04/minecraft-java-manager",
"version": "0.0.1", "version": "0.0.1",
"description": "Node module to check if java is installed and install it", "description": "Node module to check if java is installed and install it",
"keywords": [
"java",
"mclauncher",
"mc-launcher",
"minecraft-launcher",
"javainstaller",
"java-installer"
],
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://gitea.azures.fr/azures04/minecraft-java-manager" "url": "https://gitea.azures.fr/azures04/minecraft-java-manager"
}, },
"license": "MIT", "license": "MIT",
"author": { "author": "azures04 <azures04@azures.fr> (https://gitea.azures.fr)",
"name": "azures04",
"url": "https://gitea.azures.fr",
"email": "azures04@azures.fr"
},
"type": "commonjs", "type": "commonjs",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
+1 -1
View File
@@ -239,7 +239,7 @@ async function downloadJavaComponent(manifest, outputRoot, options) {
}) })
} }
return emitter return { events: emitter, path: outputRoot }
} }
module.exports = { module.exports = {
+1 -1
View File
@@ -49,7 +49,7 @@ async function determineInstallationPath(component, majorVersion, customInstallP
} }
switch (process.platform) { switch (process.platform) {
case "win32": case "win32":
return path.join("Program files", "Java", component, majorVersion) return path.join("C:", "Program files", "Java", component, majorVersion.toString())
case "linux": case "linux":
return path.join("opt", "java", component, majorVersion) return path.join("opt", "java", component, majorVersion)
case "macos": case "macos":
+1 -1
View File
@@ -1,7 +1,7 @@
const lib = require("./index") const lib = require("./index")
async function main() { async function main() {
await lib.installJava("jre-legacy", 8, "./java") await lib.installJava("1.7.10")
} }
main() main()