Skip to content

Commit

Permalink
Fix file extension for Windows platform.
Browse files Browse the repository at this point in the history
  • Loading branch information
hybloid committed Nov 14, 2023
1 parent 7bbe9bf commit 852be76
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions vscode/qodana/src/core/jdk/jbrDownloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ export async function extractJbr(filePath: string, releaseName: string, extractP
cwd: extractPath
});
let dirName = releaseName.replace('.tar.gz', '');
if (getOsAndArch().osType === 'osx') {
let osType = getOsAndArch().osType;
if (osType === 'osx') {
return path.join(extractPath, dirName, 'Contents', 'Home', 'bin', 'java');
}
return path.join(extractPath, dirName, 'bin', 'java');
return path.join(extractPath, dirName, 'bin', 'java' + (osType === 'windows' ? '.exe' : ''));
} catch (e) {
vscode.window.showErrorMessage(failedToDownloadJbr(filePath) + `: ${e}`);
telemetry.errorReceived('#extractJbr exception');
Expand Down
2 changes: 2 additions & 0 deletions vscode/qodana/src/test/suite/jdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ describe('JBR Downloader', () => {
await fs.promises.access(javaPath!);
assert.strictEqual(javaPath!.endsWith('java') || javaPath!.endsWith('java.exe'), true);
} catch (e) {
assert.fail('Failed to download and unpack the JBR');
} finally {
await fs.promises.rm(tempDirName, { recursive: true });
}
});
Expand Down

0 comments on commit 852be76

Please sign in to comment.