mirror of
https://github.com/actions/setup-java.git
synced 2025-07-01 05:14:17 +00:00
Fix for jdkDirectory on macos
This commit is contained in:
parent
1f94f70edd
commit
67a6c070ca
2 changed files with 37 additions and 6 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue