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