mirror of
https://github.com/actions/setup-java.git
synced 2025-04-21 02:16:45 +00:00
always check postfix "Contents/Home" on macOS
This commit is contained in:
parent
de1bb2b0c5
commit
d242f3f935
2 changed files with 11 additions and 13 deletions
|
@ -46,20 +46,18 @@ export class LocalDistribution extends JavaBase {
|
|||
this.architecture
|
||||
);
|
||||
|
||||
// for different Java distributions, postfix can exist or not so need to check both cases
|
||||
if (
|
||||
process.platform === 'darwin' &&
|
||||
fs.existsSync(path.join(javaPath, MACOS_JAVA_CONTENT_POSTFIX))
|
||||
) {
|
||||
javaPath = path.join(javaPath, MACOS_JAVA_CONTENT_POSTFIX);
|
||||
}
|
||||
|
||||
foundJava = {
|
||||
version: javaVersion,
|
||||
path: javaPath
|
||||
};
|
||||
}
|
||||
|
||||
// JDK folder may contain postfix "Contents/Home" on macOS
|
||||
const macOSPostfixPath = path.join(foundJava.path, MACOS_JAVA_CONTENT_POSTFIX);
|
||||
if (process.platform === 'darwin' && fs.existsSync(macOSPostfixPath)) {
|
||||
foundJava.path = macOSPostfixPath;
|
||||
}
|
||||
|
||||
core.info(`Setting Java ${foundJava.version} as default`);
|
||||
|
||||
this.setJavaDefault(foundJava.version, foundJava.path);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue