mirror of https://github.com/aminya/setup-cpp
fix: fix choco path
This commit is contained in:
parent
df6ee47b06
commit
6925e1f02c
|
@ -1,5 +1,7 @@
|
||||||
|
/* eslint-disable require-atomic-updates */
|
||||||
import { exec } from "@actions/exec"
|
import { exec } from "@actions/exec"
|
||||||
import { existsSync } from "fs"
|
import { existsSync } from "fs"
|
||||||
|
import { dirname } from "path"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
import { InstallationInfo } from "../utils/setup/setupBin"
|
import { InstallationInfo } from "../utils/setup/setupBin"
|
||||||
|
|
||||||
|
@ -36,8 +38,12 @@ export async function setupChocolatey(
|
||||||
throw new Error(`Failed to install chocolatey`)
|
throw new Error(`Failed to install chocolatey`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line require-atomic-updates
|
const maybeChoco = which.sync("choco", { nothrow: true })
|
||||||
binDir = which.sync("choco", { nothrow: true }) ?? "C:\\ProgramData\\Chocolatey\\bin\\"
|
if (maybeChoco !== null) {
|
||||||
|
binDir = dirname(maybeChoco)
|
||||||
|
} else {
|
||||||
|
binDir = "C:\\ProgramData\\Chocolatey\\bin\\"
|
||||||
|
}
|
||||||
|
|
||||||
if (existsSync(binDir)) {
|
if (existsSync(binDir)) {
|
||||||
return { binDir }
|
return { binDir }
|
||||||
|
|
Loading…
Reference in New Issue