Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/build/win32/explorer-dll-fetcher.js
3520 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
'use strict';
6
var __importDefault = (this && this.__importDefault) || function (mod) {
7
return (mod && mod.__esModule) ? mod : { "default": mod };
8
};
9
Object.defineProperty(exports, "__esModule", { value: true });
10
exports.downloadExplorerDll = downloadExplorerDll;
11
const fs_1 = __importDefault(require("fs"));
12
const debug_1 = __importDefault(require("debug"));
13
const path_1 = __importDefault(require("path"));
14
const get_1 = require("@electron/get");
15
const product_json_1 = __importDefault(require("../../product.json"));
16
const d = (0, debug_1.default)('explorer-dll-fetcher');
17
async function downloadExplorerDll(outDir, quality = 'stable', targetArch = 'x64') {
18
const fileNamePrefix = quality === 'insider' ? 'code_insider' : 'code';
19
const fileName = `${fileNamePrefix}_explorer_command_${targetArch}.dll`;
20
if (!await fs_1.default.existsSync(outDir)) {
21
await fs_1.default.mkdirSync(outDir, { recursive: true });
22
}
23
// Read and parse checksums file
24
const checksumsFilePath = path_1.default.join(path_1.default.dirname(__dirname), 'checksums', 'explorer-dll.txt');
25
const checksumsContent = fs_1.default.readFileSync(checksumsFilePath, 'utf8');
26
const checksums = {};
27
checksumsContent.split('\n').forEach(line => {
28
const trimmedLine = line.trim();
29
if (trimmedLine) {
30
const [checksum, filename] = trimmedLine.split(/\s+/);
31
if (checksum && filename) {
32
checksums[filename] = checksum;
33
}
34
}
35
});
36
d(`downloading ${fileName}`);
37
const artifact = await (0, get_1.downloadArtifact)({
38
isGeneric: true,
39
version: 'v4.0.0-350164',
40
artifactName: fileName,
41
checksums,
42
mirrorOptions: {
43
mirror: 'https://github.com/microsoft/vscode-explorer-command/releases/download/',
44
customDir: 'v4.0.0-350164',
45
customFilename: fileName
46
}
47
});
48
d(`moving ${artifact} to ${outDir}`);
49
await fs_1.default.copyFileSync(artifact, path_1.default.join(outDir, fileName));
50
}
51
async function main(outputDir) {
52
const arch = process.env['VSCODE_ARCH'];
53
if (!outputDir) {
54
throw new Error('Required build env not set');
55
}
56
await downloadExplorerDll(outputDir, product_json_1.default.quality, arch);
57
}
58
if (require.main === module) {
59
main(process.argv[2]).catch(err => {
60
console.error(err);
61
process.exit(1);
62
});
63
}
64
//# sourceMappingURL=explorer-dll-fetcher.js.map
65