fix: use untildify to get ~/vcpkg

This commit is contained in:
Amin Yahyaabadi 2021-11-21 11:00:54 -06:00
parent 08d77f1fd1
commit 2c34e1795b
3 changed files with 10 additions and 6 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,5 +1,7 @@
import { addPath } from "@actions/core"
import execa from "execa"
import path from "path"
import untildify from "untildify"
import which from "which"
import { InstallationInfo } from "../utils/setup/setupBin"
@ -8,11 +10,13 @@ let hasVCPKG = false
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function setupVcpkg(_version: string, _setupCppDir: string, _arch: string): InstallationInfo {
if (!hasVCPKG || which.sync("vcpkg", { nothrow: true }) === null) {
execa.sync("git", ["clone", "https://github.com/microsoft/vcpkg"], { cwd: "~/" })
execa.sync("./vcpkg/bootstrap-vcpkg", { cwd: "~/vcpkg" })
addPath("~/vcpkg")
execa.sync("git", ["clone", "https://github.com/microsoft/vcpkg"], { cwd: untildify("~/") })
const vcpkgDir = untildify("~/vcpkg")
execa.sync("./vcpkg/bootstrap-vcpkg", { cwd: vcpkgDir })
addPath(vcpkgDir)
hasVCPKG = true
return { binDir: vcpkgDir }
}
return { binDir: "~/vcpkg" }
return { binDir: path.dirname(which.sync("vcpkg")) }
}