Skip to content

Commit

Permalink
Environment variables ending with Path show error (#124995)
Browse files Browse the repository at this point in the history
When new environment variables ending with Path such as "VK_SDK_PATH"
complain that it cannot execute the Get-Content on the empty path (as
the variable was not set before). This shows errors when running the
SandboxTest but those are not really errors.
  • Loading branch information
sandercox authored Nov 7, 2023
1 parent 2354eee commit 6dd5731
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Tools/SandboxTest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ function Update-EnvironmentVariables {
foreach($level in "Machine","User") {
[Environment]::GetEnvironmentVariables($level).GetEnumerator() | % {
# For Path variables, append the new values, if they're not already in there
if($_.Name -match 'Path$') {
if($_.Name -match '^Path$') {
$_.Value = ($((Get-Content "Env:$($_.Name)") + ";$($_.Value)") -split ';' | Select -unique) -join ';'
}
$_
Expand Down

0 comments on commit 6dd5731

Please sign in to comment.