Skip to content

Commit

Permalink
Merge pull request #40 from atom-community/vs2022 [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya authored Jun 22, 2022
2 parents 9e8d4e2 + dd20788 commit b4f5448
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ jobs:
pnpm:
- 6
include:
- os: windows-2022
node_version: 12.18.3
arch: x64
pnpm: 6
- os: windows-2019
node_version: 12.18.3
arch: x86
Expand Down
16 changes: 8 additions & 8 deletions src/apm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export function x86ProgramFilesDirectory() {
return process.env["ProgramFiles(x86)"] || process.env.ProgramFiles
}

export function getInstalledVisualStudioFlag() {
export function getInstalledVisualStudioFlag(): string {
if (!isWin32()) {
return null
}
Expand All @@ -149,18 +149,18 @@ export function getInstalledVisualStudioFlag() {
return process.env.GYP_MSVS_VERSION
}

if (visualStudioIsInstalled("2019")) {
return "2019"
}
if (visualStudioIsInstalled("2017")) {
return "2017"
for (const vsVersion of [2022, 2019, 2017]) {
if (visualStudioIsInstalled(vsVersion)) {
return String(vsVersion)
}
}
if (visualStudioIsInstalled("14.0")) {

if (visualStudioIsInstalled(14.0)) {
return "2015"
}
}

export function visualStudioIsInstalled(version) {
export function visualStudioIsInstalled(version: number): boolean {
if (version < 2017) {
return fs.existsSync(path.join(x86ProgramFilesDirectory(), `Microsoft Visual Studio ${version}`, "Common7", "IDE"))
} else {
Expand Down

0 comments on commit b4f5448

Please sign in to comment.