Allow users to set %VSINSTALLDIR%

and update `KNOWN_VISUAL_STUDIO_INSTALLATIONS`.

Fixes #29
This commit is contained in:
Fabio Niephaus 2022-12-23 09:44:36 +01:00
parent 4aba115fa5
commit d01f5f519f
No known key found for this signature in database
GPG Key ID: F21CF5275F31DFD6
2 changed files with 19 additions and 9 deletions

12
dist/main/index.js generated vendored
View File

@ -75079,14 +75079,18 @@ const child_process_1 = __nccwpck_require__(2081);
const fs_1 = __nccwpck_require__(7147);
// Keep in sync with https://github.com/actions/virtual-environments
const KNOWN_VISUAL_STUDIO_INSTALLATIONS = [
'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise',
'C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise',
'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise',
'C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise' // 'windows-2022'
'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise' // 'windows-2016' (deprecated and removed)
];
const VCVARSALL_SUBPATH = '\\VC\\Auxiliary\\Build\\vcvarsall.bat';
if (process.env['VSINSTALLDIR']) {
// if VSINSTALLDIR is set, make it the first known installation
KNOWN_VISUAL_STUDIO_INSTALLATIONS.unshift(process.env['VSINSTALLDIR'].replace(/\\$/, ''));
}
const VCVARSALL_SUBPATH = 'VC\\Auxiliary\\Build\\vcvarsall.bat';
function findVcvarsallPath() {
for (const installation of KNOWN_VISUAL_STUDIO_INSTALLATIONS) {
const candidate = `${installation}${VCVARSALL_SUBPATH}`;
const candidate = `${installation}\\${VCVARSALL_SUBPATH}`;
if (fs_1.existsSync(candidate)) {
return candidate;
}

View File

@ -4,15 +4,21 @@ import {existsSync} from 'fs'
// Keep in sync with https://github.com/actions/virtual-environments
const KNOWN_VISUAL_STUDIO_INSTALLATIONS = [
'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise', // 'windows-2016'
'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise', // 'windows-2019' and 'windows-latest'
'C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise' // 'windows-2022'
'C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise', // 'windows-2022' and 'windows-latest'
'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise', // 'windows-2019'
'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise' // 'windows-2016' (deprecated and removed)
]
const VCVARSALL_SUBPATH = '\\VC\\Auxiliary\\Build\\vcvarsall.bat'
if (process.env['VSINSTALLDIR']) {
// if VSINSTALLDIR is set, make it the first known installation
KNOWN_VISUAL_STUDIO_INSTALLATIONS.unshift(
process.env['VSINSTALLDIR'].replace(/\\$/, '')
)
}
const VCVARSALL_SUBPATH = 'VC\\Auxiliary\\Build\\vcvarsall.bat'
function findVcvarsallPath(): string {
for (const installation of KNOWN_VISUAL_STUDIO_INSTALLATIONS) {
const candidate = `${installation}${VCVARSALL_SUBPATH}`
const candidate = `${installation}\\${VCVARSALL_SUBPATH}`
if (existsSync(candidate)) {
return candidate
}