Skip to content

Commit

Permalink
Allow users to set %VSINSTALLDIR%
Browse files Browse the repository at this point in the history
and update `KNOWN_VISUAL_STUDIO_INSTALLATIONS`.

Fixes #29
  • Loading branch information
fniephaus committed Dec 23, 2022
1 parent 4aba115 commit d01f5f5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
12 changes: 8 additions & 4 deletions dist/main/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 11 additions & 5 deletions src/msvc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit d01f5f5

Please sign in to comment.