From d68d0376b9cead7e1bf6446e71f00c8e3c965a45 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 23 Nov 2021 08:09:28 +0000 Subject: [PATCH] feature(windows): make it more clear that the user needs to update their PATH --- _webi/template.ps1 | 5 +++++ _webi/webi-pwsh.ps1 | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/_webi/template.ps1 b/_webi/template.ps1 index 71d4f82..632b72d 100644 --- a/_webi/template.ps1 +++ b/_webi/template.ps1 @@ -31,6 +31,11 @@ New-Item -Path .local\opt -ItemType Directory -Force | out-null function webi_add_path { + Write-Host '' + Write-Host '*****************************' -ForegroundColor red -BackgroundColor white + Write-Host '* IMPORTANT - READ ME *' -ForegroundColor red -BackgroundColor white + Write-Host '*****************************' -ForegroundColor red -BackgroundColor white + Write-Host '' & "$Env:USERPROFILE\.local\bin\pathman.exe" add "$args[0]" # Note: not all of these work as expected, so we use the unix-style, which is most consistent #& "$Env:USERPROFILE\.local\bin\pathman.exe" add ~/.local/bin diff --git a/_webi/webi-pwsh.ps1 b/_webi/webi-pwsh.ps1 index f9aa66d..a8bec4c 100644 --- a/_webi/webi-pwsh.ps1 +++ b/_webi/webi-pwsh.ps1 @@ -59,7 +59,17 @@ if (!(Test-Path -Path .local\bin\pathman.exe)) # Run pathman to set up the folder # (using unix style path because... cmd vs powershell vs whatever) -& "$Env:USERPROFILE\.local\bin\pathman.exe" add ~/.local/bin +$has_local_bin = echo "$Env:PATH" | Select-String -Pattern '\.local.bin' +if (!$has_local_bin) +{ + Write-Host '' + Write-Host '**********************************' -ForegroundColor red -BackgroundColor white + Write-Host '* IMPORTANT -- READ ME *' -ForegroundColor red -BackgroundColor white + Write-Host '* (run the PATH command below) *' -ForegroundColor red -BackgroundColor white + Write-Host '**********************************' -ForegroundColor red -BackgroundColor white + Write-Host '' + & "$Env:USERPROFILE\.local\bin\pathman.exe" add ~/.local/bin +} # {{ baseurl }} # {{ version }} -- 2.25.1