This repository has been archived by the owner on Jun 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1° part of migration to default chocolatey folder for installation
- Loading branch information
Jérémie Bertrand
committed
Jan 29, 2017
1 parent
a94080a
commit 35f9a04
Showing
3 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Write-Debug "Migrate Pretzel from BinRoot to normal Chocolatey directory" | ||
|
||
$binRoot = Get-BinRoot | ||
$installDir = Join-Path $binRoot "Pretzel" | ||
|
||
# Remove folder | ||
If (Test-Path $installDir){ | ||
Remove-Item $installDir -Recurse | ||
} | ||
|
||
# Remove path | ||
|
||
# get the PATH variable | ||
$envPath = $env:PATH | ||
$pathType = [System.EnvironmentVariableTarget]::User | ||
|
||
if ($envPath.ToLower().Contains($installDir.ToLower())) | ||
{ | ||
$statementTerminator = ";" | ||
Write-Debug "PATH environment variable contains old pretzel path $installDir. Removing..." | ||
$actualPath = [System.Collections.ArrayList](Get-EnvironmentVariable -Name 'Path' -Scope $pathType).split($statementTerminator) | ||
|
||
$actualPath.Remove($installDir) | ||
$newPath = $actualPath -Join $statementTerminator | ||
|
||
Set-EnvironmentVariable -Name 'Path' -Value $newPath -Scope $pathType | ||
|
||
} else { | ||
Write-Debug " The path to uninstall `'$installDir`' was not found in the `'$pathType`' PATH. Could not remove." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters