Fix Windows archives extraction issue

This commit is contained in:
Priyagupta108 2024-09-20 15:28:22 +05:30
parent 40b9536ce5
commit 0b70bb777b
15 changed files with 4450 additions and 4400 deletions

View file

@ -11,7 +11,8 @@ import {
extractJdkFile,
getDownloadArchiveExtension,
getGitHubHttpHeaders,
isVersionSatisfies
isVersionSatisfies,
renameWinArchive
} from '../../util';
import {IDragonwellVersions, IDragonwellAllVersions} from './models';
import {
@ -100,14 +101,14 @@ export class DragonwellDistribution extends JavaBase {
core.info(
`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`
);
const javaArchivePath = await tc.downloadTool(javaRelease.url);
let javaArchivePath = await tc.downloadTool(javaRelease.url);
core.info(`Extracting Java archive...`);
const extractedJavaPath = await extractJdkFile(
javaArchivePath,
getDownloadArchiveExtension()
);
const extension = getDownloadArchiveExtension();
if (process.platform === 'win32') {
javaArchivePath = renameWinArchive(javaArchivePath);
}
const extractedJavaPath = await extractJdkFile(javaArchivePath, extension);
const archiveName = fs.readdirSync(extractedJavaPath)[0];
const archivePath = path.join(extractedJavaPath, archiveName);