fix: ignore path modification error for MSVC

This commit is contained in:
Amin Yahyaabadi 2021-12-06 05:54:37 -06:00
parent 7092c4b51f
commit 487a88259f
4 changed files with 11 additions and 7 deletions

2
dist/setup_cpp.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,6 @@
import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { error } from "@actions/core"
import { setupVCVarsall } from "../vcvarsall/vcvarsall"
import { readFileSync } from "fs"
type MSVCVersion = "2015" | "2017" | "2019" | string
@ -35,9 +34,13 @@ export async function setupMSVC(
VCTargetsPath = "C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133"
}
} catch (e) {
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)
const choco_logs = readFileSync(`${process.env.ALLUSERSPROFILE}\\chocolatey\\logs\\chocolatey.log`, "utf8")
console.log(choco_logs)
}
}
// run vcvarsall.bat environment variables
setupVCVarsall(VCTargetsPath, arch, toolset, sdk, uwp, spectre)

View File

@ -1,4 +1,4 @@
import { exportVariable } from "@actions/core"
import { exportVariable, info } from "@actions/core"
import { existsSync } from "fs"
function getArch(arch: string): string {
@ -26,6 +26,7 @@ export function setupVCVarsall(
spectre?: boolean
) {
if (VCTargetsPath !== undefined && existsSync(VCTargetsPath)) {
info(`Adding ${VCTargetsPath} to PATH`)
exportVariable("VCTargetsPath", VCTargetsPath)
}