Minor fixes
This commit is contained in:
@@ -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)
|
||||
|
||||
Generated
+2
-2
@@ -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
@@ -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
@@ -239,7 +239,7 @@ async function downloadJavaComponent(manifest, outputRoot, options) {
|
||||
})
|
||||
}
|
||||
|
||||
return emitter
|
||||
return { events: emitter, path: outputRoot }
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
+1
-1
@@ -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":
|
||||
|
||||
Reference in New Issue
Block a user