mirror of
https://github.com/dscalzi/HeliosLauncher.git
synced 2024-12-23 04:02:14 -08:00
Compare commits
6 Commits
e314599d99
...
15b2efefde
Author | SHA1 | Date | |
---|---|---|---|
|
15b2efefde | ||
|
4273be5a4c | ||
|
8d26db70dc | ||
|
13f86339bb | ||
|
d9291d82e5 | ||
|
b9b67b7824 |
@ -15,8 +15,6 @@ const zlib = require('zlib')
|
|||||||
|
|
||||||
const isDev = require('./isdev')
|
const isDev = require('./isdev')
|
||||||
|
|
||||||
const isARM64 = process.arch === 'arm64'
|
|
||||||
|
|
||||||
// Classes
|
// Classes
|
||||||
|
|
||||||
/** Class representing a base asset. */
|
/** Class representing a base asset. */
|
||||||
@ -193,8 +191,7 @@ class JavaGuard extends EventEmitter {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
const arch = isARM64 ? 'aarch64' : 'x64'
|
const url = `https://corretto.aws/downloads/latest/amazon-corretto-${major}-x64-${sanitizedOS}-jdk.${ext}`
|
||||||
const url = `https://corretto.aws/downloads/latest/amazon-corretto-${major}-${arch}-${sanitizedOS}-jdk.${ext}`
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
request.head({url, json: true}, (err, resp) => {
|
request.head({url, json: true}, (err, resp) => {
|
||||||
@ -387,8 +384,6 @@ class JavaGuard extends EventEmitter {
|
|||||||
let vendorName = props[i].split('=')[1].trim()
|
let vendorName = props[i].split('=')[1].trim()
|
||||||
this.logger.debug(props[i].trim())
|
this.logger.debug(props[i].trim())
|
||||||
meta.vendor = vendorName
|
meta.vendor = vendorName
|
||||||
} else if (props[i].indexOf('os.arch') > -1) {
|
|
||||||
meta.isARM = props[i].split('=')[1].trim() === 'aarch64'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -760,9 +755,6 @@ class JavaGuard extends EventEmitter {
|
|||||||
* @param {string} dataDir The base launcher directory.
|
* @param {string} dataDir The base launcher directory.
|
||||||
* @returns {Promise.<string>} A Promise which resolves to the executable path of a valid
|
* @returns {Promise.<string>} A Promise which resolves to the executable path of a valid
|
||||||
* x64 Java installation. If none are found, null is returned.
|
* x64 Java installation. If none are found, null is returned.
|
||||||
*
|
|
||||||
* Added: On the system with ARM architecture attempts to find aarch64 Java.
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
async _darwinJavaValidate(dataDir){
|
async _darwinJavaValidate(dataDir){
|
||||||
|
|
||||||
@ -791,16 +783,7 @@ class JavaGuard extends EventEmitter {
|
|||||||
pathArr = JavaGuard._sortValidJavaArray(pathArr)
|
pathArr = JavaGuard._sortValidJavaArray(pathArr)
|
||||||
|
|
||||||
if(pathArr.length > 0){
|
if(pathArr.length > 0){
|
||||||
|
return pathArr[0].execPath
|
||||||
// TODO Revise this a bit, seems to work for now. Discovery logic should
|
|
||||||
// probably just filter out the invalid architectures before it even
|
|
||||||
// gets to this point.
|
|
||||||
if (isARM64) {
|
|
||||||
return pathArr.find(({ isARM }) => isARM)?.execPath ?? null
|
|
||||||
} else {
|
|
||||||
return pathArr.find(({ isARM }) => !isARM)?.execPath ?? null
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user