minor improvements

This commit is contained in:
Maxim Lobanov 2021-03-08 18:21:32 +03:00
parent b2da088220
commit cfdcd6827b
6 changed files with 15 additions and 14 deletions

View file

@ -8,7 +8,7 @@ import semver from 'semver';
import { JavaBase } from '../base-installer';
import { IAdoptiumAvailableVersions } from './models';
import { JavaInstallerOptions, JavaDownloadRelease, JavaInstallerResults } from '../base-models';
import { macOSJavaContentDir } from '../../constants';
import { MACOS_JAVA_CONTENT_POSTFIX } from '../../constants';
import { extractJdkFile, getDownloadArchiveExtension } from '../../util';
export class AdoptiumDistribution extends JavaBase {
@ -68,7 +68,7 @@ export class AdoptiumDistribution extends JavaBase {
javaPath = await tc.cacheDir(archivePath, this.toolcacheFolderName, version, this.architecture);
if (process.platform === 'darwin') {
javaPath = path.join(javaPath, macOSJavaContentDir);
javaPath = path.join(javaPath, MACOS_JAVA_CONTENT_POSTFIX);
}
return { version: javaRelease.version, path: javaPath };

View file

@ -8,7 +8,7 @@ import semver from 'semver';
import { JavaBase } from '../base-installer';
import { JavaInstallerOptions, JavaDownloadRelease, JavaInstallerResults } from '../base-models';
import { extractJdkFile } from '../../util';
import { macOSJavaContentDir } from '../../constants';
import { MACOS_JAVA_CONTENT_POSTFIX } from '../../constants';
export class LocalDistribution extends JavaBase {
constructor(installerOptions: JavaInstallerOptions, private jdkFile?: string) {
@ -48,11 +48,12 @@ 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, macOSJavaContentDir))
fs.existsSync(path.join(javaPath, MACOS_JAVA_CONTENT_POSTFIX))
) {
javaPath = path.join(javaPath, macOSJavaContentDir);
javaPath = path.join(javaPath, MACOS_JAVA_CONTENT_POSTFIX);
}
foundJava = {