Removing '/Contents/Home' from Java root on darwin to have the code rely on the resolve executable method.

This commit is contained in:
Daniel Scalzi 2018-04-12 22:13:26 -04:00
parent fc81016dc6
commit 12aa9f9c5b
No known key found for this signature in database
GPG Key ID: 5CA2F145B63535F9

View File

@ -570,7 +570,7 @@ class AssetGuard extends EventEmitter {
if(process.platform === 'win32'){ if(process.platform === 'win32'){
return path.join(rootDir, 'bin', 'javaw.exe') return path.join(rootDir, 'bin', 'javaw.exe')
} else if(process.platform === 'darwin'){ } else if(process.platform === 'darwin'){
return path.join(rootDir, 'bin', 'java') return path.join(rootDir, 'Contents', 'Home', 'bin', 'java')
} else if(process.platform === 'linux'){ } else if(process.platform === 'linux'){
return path.join(rootDir, 'bin', 'java') return path.join(rootDir, 'bin', 'java')
} }
@ -761,12 +761,7 @@ class AssetGuard extends EventEmitter {
console.log(err) console.log(err)
} else { } else {
for(let i=0; i<files.length; i++){ for(let i=0; i<files.length; i++){
if(process.platform === 'darwin'){ res.add(path.join(x64RuntimeDir, files[i]))
// On darwin, Java home is root/Contents/Home
res.add(path.join(x64RuntimeDir, files[i], 'Contents', 'Home'))
} else {
res.add(path.join(x64RuntimeDir, files[i]))
}
} }
resolve(res) resolve(res)
} }
@ -934,8 +929,8 @@ class AssetGuard extends EventEmitter {
*/ */
static _scanInternetPlugins(){ static _scanInternetPlugins(){
// /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java // /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
const pth = '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home' const pth = '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin'
const res = fs.existsSync(pth) const res = fs.existsSync(AssetGuard.javaExecFromRoot(pth))
return res ? pth : null return res ? pth : null
} }
@ -955,6 +950,10 @@ class AssetGuard extends EventEmitter {
// Check the JAVA_HOME environment variable. // Check the JAVA_HOME environment variable.
const jHome = AssetGuard._scanJavaHome() const jHome = AssetGuard._scanJavaHome()
if(jHome != null){ if(jHome != null){
// Ensure we are at the absolute root.
if(jHome.contains('/Contents/Home')){
jHome = jHome.substring(0, jHome.indexOf('/Contents/Home'))
}
pathSet.add(jHome) pathSet.add(jHome)
} }