Skip to content

Commit

Permalink
fix: use untildify to get ~/vcpkg
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Nov 21, 2021
1 parent 08d77f1 commit 2c34e17
Show file tree
Hide file tree
Showing 3 changed files with 10 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.

12 changes: 8 additions & 4 deletions src/vcpkg/vcpkg.ts
Original file line number Diff line number Diff line change
@@ -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"

Expand All @@ -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")) }
}

0 comments on commit 2c34e17

Please sign in to comment.