fix: use / instead of \\ on windows

This commit is contained in:
Amin Yahyaabadi 2021-09-16 18:26:57 -05:00
parent 24734937d9
commit bf456808b6
7 changed files with 13 additions and 14 deletions

View File

@ -42,7 +42,7 @@ export async function setupChocolatey(
if (maybeChoco !== null) { if (maybeChoco !== null) {
binDir = dirname(maybeChoco) binDir = dirname(maybeChoco)
} else { } else {
binDir = "C:\\ProgramData\\Chocolatey\\bin\\" binDir = "C:/ProgramData/Chocolatey/bin/"
} }
if (existsSync(binDir)) { if (existsSync(binDir)) {

View File

@ -1,12 +1,11 @@
import { setupCppcheck } from "../cppcheck" import { setupCppcheck } from "../cppcheck"
import { testBin } from "../../utils/tests/test-helpers" import { testBin } from "../../utils/tests/test-helpers"
import { InstallationInfo } from "../../utils/setup/setupBin"
jest.setTimeout(200000) jest.setTimeout(200000)
describe("setup-cppcheck", () => { describe("setup-cppcheck", () => {
it("should setup cppcheck", async () => { it("should setup cppcheck", async () => {
const installInfo = await setupCppcheck("", "", process.arch) const installInfo = await setupCppcheck("", "", process.arch)
await testBin("cppcheck", ["--version"], (installInfo as InstallationInfo | undefined)?.binDir) await testBin("cppcheck", ["--version"], installInfo.binDir)
}) })
}) })

View File

@ -8,7 +8,7 @@ export async function setupCppcheck(version: string | undefined, _setupCppDir: s
switch (process.platform) { switch (process.platform) {
case "win32": { case "win32": {
await setupChocoPack("cppcheck", version) await setupChocoPack("cppcheck", version)
const binDir = "C:\\Program Files\\Cppcheck" const binDir = "C:/Program Files/Cppcheck"
addPath(binDir) addPath(binDir)
return { binDir } return { binDir }
} }

View File

@ -9,8 +9,8 @@ export async function setupDoxygen(version: string | undefined, _setupCppDir: st
case "win32": { case "win32": {
await setupChocoPack("graphviz", version) await setupChocoPack("graphviz", version)
await setupChocoPack("doxygen.install", version) await setupChocoPack("doxygen.install", version)
addPath("C:\\Program Files\\Graphviz\\bin") addPath("C:/Program Files/Graphviz/bin")
const binDir = "C:\\Program Files\\doxygen\\bin" const binDir = "C:/Program Files/doxygen/bin"
addPath(binDir) addPath(binDir)
return { binDir } return { binDir }
} }

View File

@ -15,11 +15,11 @@ export async function setupGcc(version: string, _setupCppDir: string, arch: stri
await setupChocoPack("gcc-arm-embedded", version) await setupChocoPack("gcc-arm-embedded", version)
} }
await setupChocoPack("mingw", version) await setupChocoPack("mingw", version)
if (arch === "x64" && existsSync("C:\\tools\\mingw64\\bin")) { if (arch === "x64" && existsSync("C:/tools/mingw64/bin")) {
binDir = "C:\\tools\\mingw64\\bin" binDir = "C:/tools/mingw64/bin"
addPath(binDir) addPath(binDir)
} else if (arch === "ia32" && existsSync("C:\\tools\\mingw32\\bin")) { } else if (arch === "ia32" && existsSync("C:/tools/mingw32/bin")) {
binDir = "C:\\tools\\mingw32\\bin" binDir = "C:/tools/mingw32/bin"
addPath(binDir) addPath(binDir)
} }
break break

View File

@ -38,7 +38,7 @@ export async function setupMSVC(
toolset = "14.0.25420.1" toolset = "14.0.25420.1"
await setupChocoPack("visualcpp-build-tools", toolset, ["--ignore-dependencies", "--params", "'/IncludeRequired'"]) await setupChocoPack("visualcpp-build-tools", toolset, ["--ignore-dependencies", "--params", "'/IncludeRequired'"])
VCTargetsPath = "C:\\Program Files (x86)\\MSBuild\\Microsoft.Cpp\\v4.0\\v140" VCTargetsPath = "C:/Program Files (x86)/MSBuild/Microsoft.Cpp/v4.0/v140"
if (existsSync(VCTargetsPath)) { if (existsSync(VCTargetsPath)) {
exportVariable("VCTargetsPath", VCTargetsPath) exportVariable("VCTargetsPath", VCTargetsPath)
} }
@ -48,14 +48,14 @@ export async function setupMSVC(
"--package-parameters", "--package-parameters",
"add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended --passive", "add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended --passive",
]) ])
VCTargetsPath = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\MSBuild\\Microsoft\\VC\\v150" VCTargetsPath = "C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/MSBuild/Microsoft/VC/v150"
} else if (version === "2019") { } else if (version === "2019") {
toolset = "16.11.2.0" toolset = "16.11.2.0"
await setupChocoPack("visualstudio2019buildtools", toolset, [ await setupChocoPack("visualstudio2019buildtools", toolset, [
"--package-parameters", "--package-parameters",
"add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended --passive", "add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended --passive",
]) ])
VCTargetsPath = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\MSBuild\\Microsoft\\VC\\v160" VCTargetsPath = "C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/MSBuild/Microsoft/VC/v160"
} }
if (VCTargetsPath !== undefined && existsSync(VCTargetsPath)) { if (VCTargetsPath !== undefined && existsSync(VCTargetsPath)) {
exportVariable("VCTargetsPath", VCTargetsPath) exportVariable("VCTargetsPath", VCTargetsPath)

View File

@ -24,5 +24,5 @@ export async function setupChocoPack(name: string, version?: string, args: strin
throw new Error(`Failed to install ${name} ${version}`) throw new Error(`Failed to install ${name} ${version}`)
} }
return { binDir: "C:\\ProgramData\\Chocolatey\\bin\\" } return { binDir: "C:/ProgramData/Chocolatey/bin/" }
} }