mirror of
https://gitea.com/actions/setup-java.git
synced 2025-04-05 06:49:38 +00:00
always check postfix "Contents/Home" on macOS (#397)
This commit is contained in:
12
dist/setup/index.js
vendored
12
dist/setup/index.js
vendored
@ -104608,17 +104608,17 @@ class LocalDistribution extends base_installer_1.JavaBase {
|
||||
const archiveName = fs_1.default.readdirSync(extractedJavaPath)[0];
|
||||
const archivePath = path_1.default.join(extractedJavaPath, archiveName);
|
||||
const javaVersion = this.version;
|
||||
let javaPath = yield tc.cacheDir(archivePath, this.toolcacheFolderName, this.getToolcacheVersionName(javaVersion), this.architecture);
|
||||
// for different Java distributions, postfix can exist or not so need to check both cases
|
||||
if (process.platform === 'darwin' &&
|
||||
fs_1.default.existsSync(path_1.default.join(javaPath, constants_1.MACOS_JAVA_CONTENT_POSTFIX))) {
|
||||
javaPath = path_1.default.join(javaPath, constants_1.MACOS_JAVA_CONTENT_POSTFIX);
|
||||
}
|
||||
const javaPath = yield tc.cacheDir(archivePath, this.toolcacheFolderName, this.getToolcacheVersionName(javaVersion), this.architecture);
|
||||
foundJava = {
|
||||
version: javaVersion,
|
||||
path: javaPath
|
||||
};
|
||||
}
|
||||
// JDK folder may contain postfix "Contents/Home" on macOS
|
||||
const macOSPostfixPath = path_1.default.join(foundJava.path, constants_1.MACOS_JAVA_CONTENT_POSTFIX);
|
||||
if (process.platform === 'darwin' && fs_1.default.existsSync(macOSPostfixPath)) {
|
||||
foundJava.path = macOSPostfixPath;
|
||||
}
|
||||
core.info(`Setting Java ${foundJava.version} as default`);
|
||||
this.setJavaDefault(foundJava.version, foundJava.path);
|
||||
return foundJava;
|
||||
|
Reference in New Issue
Block a user