in vscode/qodana/src/core/cli/cliDownloader.ts [125:156]
export async function downloadAndUnpackCli(downloadedCliArchDir: string, downloadedCliDir: string): Promise<string | undefined> {
const platform = getProcessPlatformName();
const arch = getProcessArchName();
const url = getQodanaUrl(arch, platform);
const expectedChecksum = getQodanaSha256(arch, platform);
if (!url) {
return undefined;
}
// get file name from URL
const fileName = url.split('/').pop();
if (!fileName) {
vscode.window.showErrorMessage(failedToDownloadCli(url)); // case that is not possible to happen
return undefined;
}
const cliArchPath = await fetchCli(url, path.join(downloadedCliArchDir, fileName));
if (!cliArchPath) {
vscode.window.showErrorMessage(failedToDownloadCli(url));
return undefined;
}
const actualChecksum = await sha256sum(cliArchPath);
if (actualChecksum !== expectedChecksum) {
vscode.window.showErrorMessage(cliChecksumMismatch(url));
return undefined;
}
let extractRoot: string | undefined;
if (process.platform === 'win32') {
extractRoot = await extractZip(cliArchPath, downloadedCliDir);
} else {
extractRoot = await extractTar(cliArchPath, downloadedCliDir);
}
return await computeExtractedCliPath(extractRoot);
}