fix(install): use install.ps1 immediately + honest PATH guidance
The persisted User PATH only reaches newly-started processes, so the old "restart your shell" advice was wrong — a sign-out/in was actually needed (observed on Windows 11). Update the current session's $env:Path as well so the command works right away in the same window, and reword the notice. Also refresh the header: verified on ARM64 Windows 11 under Windows PowerShell 5.1 and PowerShell 7.6 against the live v0.2.0 release.
This commit is contained in:
+15
-5
@@ -24,9 +24,11 @@
|
||||
%LOCALAPPDATA%\Programs\rdbms-playground.
|
||||
|
||||
.NOTES
|
||||
Written but NOT tested on Windows from this environment (no PowerShell
|
||||
here) — validate on a real Windows host. The verified sibling is
|
||||
install.sh (Linux/macOS).
|
||||
Verified end-to-end on ARM64 Windows 11 under both Windows PowerShell 5.1
|
||||
and PowerShell 7.6, against the live v0.2.0 release. The x86_64 branch is
|
||||
symmetric (env-based arch detection + a confirmed matching release asset)
|
||||
but has not been run directly. The sibling installer is install.sh
|
||||
(Linux/macOS).
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
@@ -98,14 +100,22 @@ try {
|
||||
Move-Item -Path $exe -Destination $dest -Force
|
||||
Write-Host "installed $Bin $Version -> $dest"
|
||||
|
||||
# Add the install dir to the user PATH (persistent) if it's not there.
|
||||
# Persist the install dir on the user PATH (for future shells) if missing.
|
||||
$userPath = [Environment]::GetEnvironmentVariable('Path', 'User')
|
||||
if (-not $userPath) { $userPath = '' }
|
||||
if (($userPath -split ';') -notcontains $InstallDir) {
|
||||
$newPath = if ($userPath) { "$userPath;$InstallDir" } else { $InstallDir }
|
||||
[Environment]::SetEnvironmentVariable('Path', $newPath, 'User')
|
||||
Write-Host "added $InstallDir to your user PATH — restart your shell to pick it up"
|
||||
}
|
||||
# Also update THIS session's PATH so the command works immediately. The
|
||||
# persisted change only reaches newly-started processes; an already-running
|
||||
# shell (and, depending on how the terminal inherited its environment, even
|
||||
# a freshly-opened one) won't see it until the next sign-out/in.
|
||||
if (($env:Path -split ';') -notcontains $InstallDir) {
|
||||
$env:Path = "$env:Path;$InstallDir"
|
||||
}
|
||||
Write-Host "added $InstallDir to your PATH — '$Bin' works in this window now."
|
||||
Write-Host "for shells already open elsewhere, sign out and back in (or open a fresh one)."
|
||||
}
|
||||
finally {
|
||||
Remove-Item -Path $tmp -Recurse -Force -ErrorAction SilentlyContinue
|
||||
|
||||
Reference in New Issue
Block a user