Skip to content

Commit f7f624b

Browse files
committed
Fix install command (powershell)
1 parent 96e2c9b commit f7f624b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

templates/cli/install.ps1.twig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ ${{ spec.title | upper }}_DOWNLOAD_DIR = Join-Path -Path $env:TEMP -ChildPath "{
2121

2222
# {{ spec.title | caseUcfirst }} CLI location
2323
${{ spec.title | upper }}_INSTALL_DIR = Join-Path -Path $env:LOCALAPPDATA -ChildPath "{{ spec.title | caseUcfirst }}"
24+
${{ spec.title | upper }}_INSTALL_FILE = Join-Path -Path ${{ spec.title | upper }}_INSTALL_DIR -ChildPath "{{ language.params.executableName }}.exe"
2425

2526
$USER_PATH_ENV_VAR = [Environment]::GetEnvironmentVariable("PATH", "User")
2627

@@ -53,8 +54,8 @@ function DownloadBinary {
5354
Invoke-WebRequest -Uri $GITHUB_x64_URL -OutFile ${{ spec.title | upper }}_DOWNLOAD_DIR
5455
}
5556

56-
57-
Move-Item ${{ spec.title | upper }}_DOWNLOAD_DIR ${{ spec.title | upper }}_INSTALL_DIR
57+
New-Item -ItemType Directory -Force -Path ${{ spec.title | upper }}_INSTALL_DIR | Out-Null
58+
Move-Item ${{ spec.title | upper }}_DOWNLOAD_DIR ${{ spec.title | upper }}_INSTALL_FILE
5859
}
5960

6061

@@ -65,6 +66,7 @@ function Install {
6566
Write-Host "Skipping to add {{ spec.title | caseUcfirst }} to User Path."
6667
} else {
6768
[System.Environment]::SetEnvironmentVariable("PATH", $USER_PATH_ENV_VAR + ";${{ spec.title | upper }}_INSTALL_DIR", "User")
69+
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
6870
}
6971
}
7072

0 commit comments

Comments
 (0)