From 4f9dc2f9637d8058e29aa9c6daf950c21d585958 Mon Sep 17 00:00:00 2001 From: Vincenzo Mantova <1962985+xworld21@users.noreply.github.com> Date: Sun, 11 Jan 2026 17:45:35 +0000 Subject: [PATCH] fix(system): Update TargetEnvVar instead of PATH --- lib/system.ps1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/system.ps1 b/lib/system.ps1 index 692cb40275..d849245cbb 100644 --- a/lib/system.ps1 +++ b/lib/system.ps1 @@ -107,15 +107,15 @@ function Add-Path { if (!$inPath -or $Force) { if (!$Quiet) { $Path | ForEach-Object { - Write-Host "Adding $(friendly_path $_) to $(if ($Global) {'global'} else {'your'}) path." + Write-Host "Adding $(friendly_path $_) to $(if ($Global) {'global'} else {'your'}) $TargetEnvVar." } } Set-EnvVar -Name $TargetEnvVar -Value ((@($Path) + $strippedPath) -join ';') -Global:$Global } # current session - $inPath, $strippedPath = Split-PathLikeEnvVar $Path $env:PATH + $inPath, $strippedPath = Split-PathLikeEnvVar $Path (Get-Content "env:$TargetEnvVar" -ErrorAction Ignore) if (!$inPath -or $Force) { - $env:PATH = (@($Path) + $strippedPath) -join ';' + Set-Content "env:$TargetEnvVar" ((@($Path) + $strippedPath) -join ';') } } @@ -133,15 +133,15 @@ function Remove-Path { if ($inPath) { if (!$Quiet) { $Path | ForEach-Object { - Write-Host "Removing $(friendly_path $_) from $(if ($Global) {'global'} else {'your'}) path." + Write-Host "Removing $(friendly_path $_) from $(if ($Global) {'global'} else {'your'}) $TargetEnvVar." } } Set-EnvVar -Name $TargetEnvVar -Value $strippedPath -Global:$Global } # current session - $inSessionPath, $strippedPath = Split-PathLikeEnvVar $Path $env:PATH + $inSessionPath, $strippedPath = Split-PathLikeEnvVar $Path (Get-Content "env:$TargetEnvVar" -ErrorAction Ignore) if ($inSessionPath) { - $env:PATH = $strippedPath + Set-Content "env:$TargetEnvVar" $strippedPath } if ($PassThru) { return $inPath