Skip to content
This repository was archived by the owner on Sep 1, 2023. It is now read-only.

Commit b9e6c5e

Browse files
committed
fix(windows-installer): add guard around add-path
1 parent 42b51a7 commit b9e6c5e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

docs/installer/windows.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

22
function Add-Path($Path) {
3+
$env:Path += ":" + $Path;
34
$Path = [Environment]::GetEnvironmentVariable("PATH", "User") + [IO.Path]::PathSeparator + $Path
45
[Environment]::SetEnvironmentVariable( "Path", $Path, "User")
56
}
@@ -10,7 +11,12 @@ $out_dir = $env:APPDATA + "\discloud\"
1011
mkdir $out_dir -ea 0
1112
"Extracting files"
1213
Expand-Archive $discloud_zip -DestinationPath $out_dir -Force
13-
Add-Path $out_dir
14+
if([Environment]::GetEnvironmentVariable("PATH", "User") -split ";" -ccontains $out_dir) {
15+
"Path is already setup correctly"
16+
} else {
17+
Add-Path $out_dir
18+
"Path configured successfully"
19+
}
1420
"Cleaning up temporary files"
1521
Remove-Item $discloud_zip.FullName -Force
1622
"Done! You might want to restart your system to make the discloud cli available in the PATH"

0 commit comments

Comments
 (0)