From 65f34718f91ff7f88878dd61d784cd333eed3757 Mon Sep 17 00:00:00 2001 From: booleanmaybe Date: Sun, 25 Jan 2026 23:48:43 -0500 Subject: [PATCH] fix windows install --- install.ps1 | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/install.ps1 b/install.ps1 index d34bcb2..7c5e40f 100644 --- a/install.ps1 +++ b/install.ps1 @@ -61,5 +61,37 @@ New-Item -ItemType Directory -Path $InstallDir -Force | Out-Null Copy-Item -Path $exePath -Destination (Join-Path $InstallDir "tiki.exe") -Force Write-Info "installed tiki to $InstallDir\tiki.exe" -Write-Info "add to path: setx PATH `"$InstallDir;$env:PATH`"" + +# Check if already in PATH +$userPath = [Environment]::GetEnvironmentVariable("Path", "User") +$needsPathUpdate = $true +if ($userPath) { + $pathParts = $userPath -split ";" + if ($pathParts -contains $InstallDir) { + Write-Info "$InstallDir is already in PATH" + $needsPathUpdate = $false + } +} + +if ($needsPathUpdate) { + try { + # Add to user PATH permanently (affects new sessions) + if ($userPath) { + $newPath = "$InstallDir;$userPath" + } else { + $newPath = $InstallDir + } + [Environment]::SetEnvironmentVariable("Path", $newPath, "User") + Write-Info "added $InstallDir to PATH" + + # Also update current session so tiki works immediately + $env:PATH = "$InstallDir;$env:PATH" + } catch { + Write-Warning "failed to update PATH automatically: $_" + Write-Info "add to path manually: setx PATH `"$InstallDir;$env:PATH`"" + Write-Info "then restart PowerShell" + exit 1 + } +} + Write-Info "run: tiki --version"