remove extra logic

This commit is contained in:
Maxim Lobanov 2021-03-19 12:40:45 +03:00
commit 3ad305894c
2 changed files with 2 additions and 36 deletions

View file

@ -72,10 +72,8 @@ export class ZuluDistribution extends JavaBase {
const archiveName = fs.readdirSync(extractedJavaPath)[0];
const archivePath = path.join(extractedJavaPath, archiveName);
const jdkPath = this.findJDKInstallationSubfolder(archivePath);
const javaPath = await tc.cacheDir(
jdkPath,
archivePath,
this.toolcacheFolderName,
this.getToolcacheVersionName(javaRelease.version),
this.architecture
@ -162,21 +160,4 @@ export class ZuluDistribution extends JavaBase {
return mainVersion;
}
private findJDKInstallationSubfolder(archiveFolder: string) {
if (process.platform != 'darwin') {
return archiveFolder;
}
// Zulu archive on macOS contains a set of symlinks and zulu-<major_version>.jdk subfolder
const jdkFolders = fs
.readdirSync(archiveFolder, { withFileTypes: true })
.filter(item => item.isDirectory() && !item.isSymbolicLink())
.filter(item => /^zulu-\d+\.\w+$/.test(item.name));
if (jdkFolders.length === 0) {
return archiveFolder;
}
return path.join(archiveFolder, jdkFolders[0].name);
}
}