Normalize Windows process PATH checks
ci / test (push) Canceled after 0s
ci / fuzz-smoke (push) Canceled after 0s
ci / macos-client (macos-aarch64, macos-14) (push) Canceled after 0s
ci / macos-client (macos-x86_64, macos-13) (push) Canceled after 0s
ci / windows-client (push) Canceled after 0s
ci / package-release (linux-x86_64, ubuntu-latest, , , ) (push) Canceled after 0s
ci / package-release (macos-aarch64, macos-14, , , ) (push) Canceled after 0s
ci / package-release (macos-x86_64, macos-13, , , ) (push) Canceled after 0s
ci / package-release (windows-aarch64, windows-latest, aarch64, windows, aarch64-pc-windows-msvc) (push) Canceled after 0s
ci / package-release (windows-x86_64, windows-latest, , , ) (push) Canceled after 0s
ci / remote-bench (push) Canceled after 0s
ci / publish-gitea-release (push) Canceled after 0s

This commit is contained in:
DuProcess
2026-07-16 21:57:37 -04:00
parent db7c5f97c0
commit b328854e1b
2 changed files with 23 additions and 4 deletions
+18 -1
View File
@@ -303,6 +303,23 @@ function Normalize-PathForCompare($Path) {
)
}
function PathList-Contains($PathValue, $PathToFind) {
if (-not $PathValue) {
return $false
}
$wanted = Normalize-PathForCompare $PathToFind
foreach ($entry in ($PathValue -split ';' | Where-Object { $_ })) {
try {
if ((Normalize-PathForCompare $entry) -ieq $wanted) {
return $true
}
}
catch {
}
}
return $false
}
function Assert-NoRelativePathSegments($Path) {
foreach ($segment in ($Path -split '[\\/]')) {
if ($segment -eq "." -or $segment -eq "..") {
@@ -339,7 +356,7 @@ function Add-UserPath($PathToAdd) {
$entries = @($userPath -split ';' | Where-Object { $_ })
}
$wanted = Normalize-PathForCompare $PathToAdd
if (-not (";$env:Path;").Contains(";$PathToAdd;")) {
if (-not (PathList-Contains $env:Path $PathToAdd)) {
$env:Path = "$PathToAdd;$env:Path"
}
foreach ($entry in $entries) {