X-Git-Url: https://git.josue.xyz/?a=blobdiff_plain;f=_webi%2Fwebi-pwsh.ps1;h=a8bec4cea012b5448fcbf60fa441e71896228a98;hb=refs%2Fremotes%2Forigin%2FHEAD;hp=73f30982aaeb299e0de83dff96c2c9b118f8d5ac;hpb=5d070244d47f519d7f667d12061d34e37de4defd;p=webi-installers%2F.git diff --git a/_webi/webi-pwsh.ps1 b/_webi/webi-pwsh.ps1 index 73f3098..a8bec4c 100644 --- a/_webi/webi-pwsh.ps1 +++ b/_webi/webi-pwsh.ps1 @@ -25,20 +25,22 @@ $exename = $args[0] pushd $Env:USERPROFILE # Make paths if needed -New-Item -Path .local\bin -ItemType Directory -Force +New-Item -Path .local\bin -ItemType Directory -Force | out-null # TODO replace all xbin with opt\bin\ -New-Item -Path .local\xbin -ItemType Directory -Force +New-Item -Path .local\xbin -ItemType Directory -Force | out-null # See note on Set-ExecutionPolicy above Set-Content -Path .local\bin\webi.bat -Value "@echo off`r`npushd %USERPROFILE%`r`npowershell -ExecutionPolicy Bypass .local\bin\webi-pwsh.ps1 %1`r`npopd" +# Backwards-compat bugfix: remove old webi-pwsh.ps1 location +Remove-Item -Path .local\bin\webi.ps1 -Recurse -ErrorAction Ignore if (!(Test-Path -Path .local\opt)) { - New-Item -Path .local\opt -ItemType Directory -Force + New-Item -Path .local\opt -ItemType Directory -Force | out-null } # TODO windows version of mktemp -d if (!(Test-Path -Path .local\tmp)) { - New-Item -Path .local\tmp -ItemType Directory -Force + New-Item -Path .local\tmp -ItemType Directory -Force | out-null } # TODO SetStrictMode @@ -57,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 }}