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
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:
+18
-1
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user