Compare commits

..

6 Commits

Author SHA1 Message Date
Daniel Scalzi
15b2efefde
remove more replaced code. 2023-03-06 22:57:21 -05:00
Daniel Scalzi
4273be5a4c
delete more stuff 2023-02-25 17:13:08 -05:00
Daniel Scalzi
8d26db70dc
Start to prune original asset guard to see what still needs to be replaced. 2023-02-25 03:38:21 -05:00
Daniel Scalzi
13f86339bb
Inject common/instance dir. 2023-02-25 03:28:40 -05:00
Daniel Scalzi
d9291d82e5
Progress checkin, mostly works. 2023-02-25 03:09:22 -05:00
Daniel Scalzi
b9b67b7824
Replace distromanager, assetguard is probably broken. 2023-02-24 21:02:18 -05:00

View File

@ -15,8 +15,6 @@ const zlib = require('zlib')
const isDev = require('./isdev')
const isARM64 = process.arch === 'arm64'
// Classes
/** Class representing a base asset. */
@ -193,8 +191,7 @@ class JavaGuard extends EventEmitter {
break
}
const arch = isARM64 ? 'aarch64' : 'x64'
const url = `https://corretto.aws/downloads/latest/amazon-corretto-${major}-${arch}-${sanitizedOS}-jdk.${ext}`
const url = `https://corretto.aws/downloads/latest/amazon-corretto-${major}-x64-${sanitizedOS}-jdk.${ext}`
return new Promise((resolve, reject) => {
request.head({url, json: true}, (err, resp) => {
@ -387,8 +384,6 @@ class JavaGuard extends EventEmitter {
let vendorName = props[i].split('=')[1].trim()
this.logger.debug(props[i].trim())
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.
* @returns {Promise.<string>} A Promise which resolves to the executable path of a valid
* 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){
@ -791,16 +783,7 @@ class JavaGuard extends EventEmitter {
pathArr = JavaGuard._sortValidJavaArray(pathArr)
if(pathArr.length > 0){
// 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
}
return pathArr[0].execPath
} else {
return null
}
@ -1223,4 +1206,4 @@ class AssetGuard extends EventEmitter {
module.exports = {
AssetGuard,
JavaGuard
}
}