From 2844e4938457c8c817aafe73dad89095dde3669c Mon Sep 17 00:00:00 2001 From: DuProcess <273172371+DuProcess@users.noreply.github.com> Date: Thu, 16 Jul 2026 21:42:24 -0400 Subject: [PATCH] Refresh Windows PATH during install --- install.ps1 | 3 +++ tests/release_scripts.rs | 2 ++ 2 files changed, 5 insertions(+) diff --git a/install.ps1 b/install.ps1 index 80516ea..ea4034e 100644 --- a/install.ps1 +++ b/install.ps1 @@ -344,6 +344,9 @@ function Add-UserPath($PathToAdd) { $PathToAdd } [Environment]::SetEnvironmentVariable("Path", $next, "User") + if (-not (";$env:Path;").Contains(";$PathToAdd;")) { + $env:Path = "$PathToAdd;$env:Path" + } } function Write-Utf8NoBom($Path, $Content) { diff --git a/tests/release_scripts.rs b/tests/release_scripts.rs index 3906564..e67cba4 100644 --- a/tests/release_scripts.rs +++ b/tests/release_scripts.rs @@ -216,6 +216,8 @@ fn windows_installer_adds_user_path_idempotently() { assert!(ps1.contains("$wanted = Normalize-PathForCompare $PathToAdd")); assert!(ps1.contains("-ieq $wanted")); assert!(ps1.contains("(@($entries) + $PathToAdd) -join ';'")); + assert!(ps1.contains("(\";$env:Path;\").Contains(\";$PathToAdd;\")")); + assert!(ps1.contains("$env:Path = \"$PathToAdd;$env:Path\"")); assert!( !ps1.contains("\"$userPath;$bindir\""), "Windows installer must not write a leading semicolon when user PATH is empty"