From b13628b24bfd280931f5d195149883d9eb848cc6 Mon Sep 17 00:00:00 2001 From: Simon Nordberg Date: Wed, 23 Sep 2026 09:52:00 +0200 Subject: [PATCH] fix: auto-add install directory to PATH on Windows --- README.md | 13 ++++--------- scripts/install.ps1 | 8 ++++---- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 2097054..5c106fa 100644 --- a/README.md +++ b/README.md @@ -36,15 +36,10 @@ irm https://releases.codebahn.net/cli/install.ps1 | iex ``` This downloads the latest binary, verifies its SHA256 checksum and GPG -signature (if gpg is installed), and installs to -`%LOCALAPPDATA%\Programs\codebahn`. Override with `$env:INSTALL_DIR`. - -After install, add the directory to your PATH if the script warns it is -missing: - -```powershell -[Environment]::SetEnvironmentVariable('Path', "$env:LOCALAPPDATA\Programs\codebahn;$([Environment]::GetEnvironmentVariable('Path', 'User'))", 'User') -``` +signature (if gpg is installed), installs to +`%LOCALAPPDATA%\Programs\codebahn`, and adds it to your PATH. +Override the install location with `$env:INSTALL_DIR`. Restart your +terminal after install. ### From source diff --git a/scripts/install.ps1 b/scripts/install.ps1 index fd3aeef..eafc3f5 100644 --- a/scripts/install.ps1 +++ b/scripts/install.ps1 @@ -101,10 +101,10 @@ function Install-Codebahn { $userPath = [Environment]::GetEnvironmentVariable('Path', 'User') if ($userPath -notlike "*$InstallDir*") { - Write-Host '' - Write-Host "Warning: $InstallDir is not in your PATH." - Write-Host "Add it with: `$env:Path = `"$InstallDir;`$env:Path`"" - Write-Host "Or permanently: [Environment]::SetEnvironmentVariable('Path', `"$InstallDir;`$([Environment]::GetEnvironmentVariable('Path', 'User'))`", 'User')" + [Environment]::SetEnvironmentVariable('Path', "$InstallDir;$userPath", 'User') + $env:Path = "$InstallDir;$env:Path" + Write-Host "Added $InstallDir to your PATH." + Write-Host 'Restart your terminal for the change to take effect in new sessions.' } } finally {