mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 06:37:46 +00:00
update vswhere location for nu_msvs (#882)
This PR makes the location of vswhere more programmatic by looking where it's supposed to be located on the file system instead of relying on it being in your path.
This commit is contained in:
parent
ddbebf197d
commit
92db3a88eb
1 changed files with 8 additions and 2 deletions
|
@ -3,10 +3,16 @@ def --env find_msvs [] {
|
|||
$env.MSVS_BASE_PATH = $env.Path
|
||||
$env.PATH_VAR = (if "Path" in $env { "Path" } else { "PATH" })
|
||||
|
||||
# This is a total hack because nushell doesn't like parentheses in an environment variable like `$env.ProgramFiles(x86)`
|
||||
let programfiles = $env | transpose name value | where name starts-with Program and name ends-with '(x86)' | get value.0
|
||||
# According to https://github.com/microsoft/vswhere/wiki/Installing, vswhere should always be in this location.
|
||||
let vswhere_cmd = $'($programfiles)\Microsoft Visual Studio\Installer\vswhere.exe'
|
||||
|
||||
let info = (
|
||||
if not (which vswhere | is-empty) {
|
||||
(vswhere -format json | from json)
|
||||
if ($vswhere_cmd | path exists) {
|
||||
(^$vswhere_cmd -format json | from json)
|
||||
} else {
|
||||
# this should really error out here
|
||||
('{"installationPath": [""]}' | from json)
|
||||
}
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue