Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update getJavaHome on JdkHelper.ts #907

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Update JdkHelper.ts
- Fix function  static getJavaHome
HashibulAmin authored Feb 12, 2025
commit f8f87228eee1a18baf721cb347f80f49f8c078c2
4 changes: 2 additions & 2 deletions packages/core/src/lib/jdk/JdkHelper.ts
Original file line number Diff line number Diff line change
@@ -78,11 +78,11 @@ export class JdkHelper {
* @param {Config} config The bubblewrap general configuration
* @param {NodeJS.Process} process Information from the OS process
*/
static getJavaHome(jdkPath, process) {
static getJavaHome(jdkPath: string, process: NodeJS.Process): string {
const joinPath = (process.platform === 'win32') ? path.win32.join : path.posix.join;
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') || jdkPath.endsWith('/Contents/Home/')) {
if (jdkPath.endsWith('/Contents/Home/')) {
return jdkPath;
}
return joinPath(jdkPath, '/Contents/Home/');