diff --git a/dist/setup/index.js b/dist/setup/index.js index 46a4e141..8e980ba1 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -33650,7 +33650,7 @@ function unzipJavaDownload(repoRoot, fileEnding, destinationFolder, extension) { const stats = fs.statSync(jdkFile); if (stats.isFile()) { yield extractFiles(jdkFile, fileEnding, destinationFolder); - const jdkDirectory = path.join(destinationFolder, fs.readdirSync(destinationFolder)[0]); + const jdkDirectory = getJdkDirectory(destinationFolder); yield unpackJars(jdkDirectory, path.join(jdkDirectory, 'bin')); return jdkDirectory; } @@ -33725,7 +33725,9 @@ function getDownloadInfo(refs, version, arch, javaPackage, distro = 'zulu') { url += '&architecture=' + architecture; url += '&operating_system=' + operatingSystem; url += '&archive_type=' + archiveType; - if (version.includes('x') || version.includes('ea') || version.startsWith('1.')) { + if (version.includes('x') || + version.includes('ea') || + version.startsWith('1.')) { url += '&latest=overall'; } const http = new httpm.HttpClient('bundles', undefined, { @@ -33790,6 +33792,21 @@ function getPackageFileUrl(ephemeralId) { return ''; }); } +function getJdkDirectory(destinationFolder) { + const jdkRoot = path.join(destinationFolder, fs.readdirSync(destinationFolder)[0]); + if (process.platform === 'darwin') { + const binDirectory = path.join(jdkRoot, 'bin'); + if (fs.existsSync(binDirectory)) { + return jdkRoot; + } + else { + return path.join(jdkRoot, 'Contents', 'Home'); + } + } + else { + return jdkRoot; + } +} /***/ }), diff --git a/src/installer.ts b/src/installer.ts index 2d158e34..c662699e 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -176,10 +176,7 @@ async function unzipJavaDownload( const stats = fs.statSync(jdkFile); if (stats.isFile()) { await extractFiles(jdkFile, fileEnding, destinationFolder); - const jdkDirectory = path.join( - destinationFolder, - fs.readdirSync(destinationFolder)[0] - ); + const jdkDirectory = getJdkDirectory(destinationFolder); await unpackJars(jdkDirectory, path.join(jdkDirectory, 'bin')); return jdkDirectory; } else { @@ -328,3 +325,20 @@ async function getPackageFileUrl(ephemeralId: string) { } return ''; } + +function getJdkDirectory(destinationFolder: string): string { + const jdkRoot: string = path.join( + destinationFolder, + fs.readdirSync(destinationFolder)[0] + ); + if (process.platform === 'darwin') { + const binDirectory: string = path.join(jdkRoot, 'bin'); + if (fs.existsSync(binDirectory)) { + return jdkRoot; + } else { + return path.join(jdkRoot, 'Contents', 'Home'); + } + } else { + return jdkRoot; + } +}