File tree 1 file changed +5
-6
lines changed
modules/virtual_environments/nu_msvs 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -4,20 +4,19 @@ def --env find_msvs [] {
4
4
$env .PATH_VAR = (if " Path" in $env { " Path" } else { " PATH" })
5
5
6
6
# This is a total hack because nushell doesn't like parentheses in an environment variable like `$env.ProgramFiles(x86)`
7
- let programfiles = $env | transpose name value | where name starts-with Program and name ends-with ' (x86)' | get value.0
7
+ let programfiles = $env | transpose name value | where name starts-with Program and name ends-with ' (x86)' | get value.0 | str trim
8
8
# According to https://github.com/microsoft/vswhere/wiki/Installing, vswhere should always be in this location.
9
- let vswhere_cmd = $' ($programfiles )\Microsoft Visual Studio\Installer\vswhere.exe'
10
-
9
+ let vswhere_cmd = ($' ($programfiles )\Microsoft Visual Studio\Installer\vswhere.exe' )
11
10
let info = (
12
11
if ($vswhere_cmd | path exists ) {
13
- (^$vswhere_cmd -format json | from json )
12
+ (^$vswhere_cmd -prerelease -products ' * ' - format json - nocolor - utf8 - sort | from json )
14
13
} else {
15
14
# this should really error out here
16
- (' {"installationPath": [""]} ' | from json )
15
+ (' [ {"installationPath": ""}] ' | from json )
17
16
}
18
17
)
19
18
20
- $env .MSVS_ROOT = $info.installationPath.0
19
+ $env .MSVS_ROOT = $info.0.installationPath
21
20
22
21
$env .MSVS_MSVC_ROOT = (
23
22
if not ($' ($env .MSVS_ROOT )\VC\Tools\MSVC\' | path exists ) {
You can’t perform that action at this time.
0 commit comments