Revise logic a bit.
This commit is contained in:
parent
6dec7903b7
commit
96c1a5d7a8
@ -302,7 +302,8 @@ class JavaGuard extends EventEmitter {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
const url = `https://corretto.aws/downloads/latest/amazon-corretto-${major}-${process.arch.includes("arm") ? "aarch64" : "x64"}-${sanitizedOS}-jdk.${ext}`
|
const arch = process.arch.includes('arm') ? '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) => {
|
||||||
@ -899,13 +900,16 @@ class JavaGuard extends EventEmitter {
|
|||||||
pathArr = JavaGuard._sortValidJavaArray(pathArr)
|
pathArr = JavaGuard._sortValidJavaArray(pathArr)
|
||||||
|
|
||||||
if(pathArr.length > 0){
|
if(pathArr.length > 0){
|
||||||
let amd64 = pathArr.find(({ isARM }) => !isARM)
|
|
||||||
let arm = pathArr.find(({ isARM }) => isARM)
|
// TODO Revise this a bit, seems to work for now. Discovery logic should
|
||||||
if (process.arch.includes("arm")) {
|
// probably just filter out the invalid architectures before it even
|
||||||
if (arm) return arm.execPath
|
// gets to this point.
|
||||||
return null
|
if (process.arch.includes('arm')) {
|
||||||
|
return pathArr.find(({ isARM }) => isARM)?.execPath ?? null
|
||||||
|
} else {
|
||||||
|
return pathArr.find(({ isARM }) => !isARM)?.execPath ?? null
|
||||||
}
|
}
|
||||||
return amd64.execPath
|
|
||||||
} else {
|
} else {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user