Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions packages/core/src/lib/jdk/JdkHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,17 @@ export class JdkHelper {
* @param {Config} config The bubblewrap general configuration
* @param {NodeJS.Process} process Information from the OS process
*/
static getJavaHome(jdkPath: string, process: NodeJS.Process): string {
static getJavaHome(jdkPath: string, process: NodeJS.Process): string {
const joinPath = (process.platform === 'win32') ? path.win32.join : path.posix.join;
if (process.platform === 'darwin') {
return joinPath(jdkPath, '/Contents/Home/');
} else if (process.platform === 'linux' || process.platform === 'win32') {
return joinPath(jdkPath, '/');
}
if (process.platform === 'darwin') {
// If jdkPath already ends with '/Contents/Home' (with or without a trailing slash), return as is.
if (jdkPath.endsWith('/Contents/Home/')) {
return jdkPath;
}
return joinPath(jdkPath, '/Contents/Home/');
} else if (process.platform === 'linux' || process.platform === 'win32') {
return joinPath(jdkPath, '/');
}
throw new Error(`Unsupported Platform: ${process.platform}`);
}

Expand Down