mirror of
https://github.com/dscalzi/HeliosLauncher.git
synced 2024-12-22 19:52:14 -08:00
Compare commits
9 Commits
15b2efefde
...
e314599d99
Author | SHA1 | Date | |
---|---|---|---|
|
e314599d99 | ||
|
28c9c65220 | ||
|
43b26ef1b9 | ||
|
e9a5f80a36 | ||
|
9a4129c11a | ||
|
b32857e7de | ||
|
a22bd32cb1 | ||
|
45630c068c | ||
|
fb586cca69 |
@ -15,6 +15,8 @@ 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. */
|
||||||
@ -191,7 +193,8 @@ class JavaGuard extends EventEmitter {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
const url = `https://corretto.aws/downloads/latest/amazon-corretto-${major}-x64-${sanitizedOS}-jdk.${ext}`
|
const arch = isARM64 ? 'aarch64' : 'x64'
|
||||||
|
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) => {
|
||||||
@ -384,6 +387,8 @@ 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'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -755,6 +760,9 @@ 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){
|
||||||
|
|
||||||
@ -783,7 +791,16 @@ 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
|
||||||
}
|
}
|
||||||
@ -1206,4 +1223,4 @@ class AssetGuard extends EventEmitter {
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
AssetGuard,
|
AssetGuard,
|
||||||
JavaGuard
|
JavaGuard
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user