Skip to content

Commit

Permalink
fix: ignore path modification error for MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Dec 6, 2021
1 parent 7092c4b commit 2f0abd1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dist/setup_cpp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/setup_cpp.js.map

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions src/msvc/msvc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,13 @@ export async function setupMSVC(
VCTargetsPath = "C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133"
}
} catch (e) {
error(e as string | Error)
const choco_logs = readFileSync(`${process.env.ALLUSERSPROFILE}\\chocolatey\\logs\\chocolatey.log`, "utf8")
console.log(choco_logs)
if (
!(e as string | Error)
.toString()
.includes("Item has already been added. Key in dictionary: 'Path' Key being added: 'PATH'")
) {
error(e as string | Error)
}
}
// run vcvarsall.bat environment variables
setupVCVarsall(VCTargetsPath, arch, toolset, sdk, uwp, spectre)
Expand Down
3 changes: 2 additions & 1 deletion src/vcvarsall/vcvarsall.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { exportVariable } from "@actions/core"
import { exportVariable, info } from "@actions/core"
import { existsSync } from "fs"

function getArch(arch: string): string {
Expand Down Expand Up @@ -26,6 +26,7 @@ export function setupVCVarsall(
spectre?: boolean
) {
if (VCTargetsPath !== undefined && existsSync(VCTargetsPath)) {
info(`Adding ${VCTargetsPath} to PATH`)
exportVariable("VCTargetsPath", VCTargetsPath)
}

Expand Down

0 comments on commit 2f0abd1

Please sign in to comment.