File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818 Remove-Item " $tools \..\lib" - Recurse - Force
1919 }
2020
21+ # Handle upgrade from previous packages that installed to the %AppData%/scriptcs folders.
22+ $oldPaths = @ (
23+ " $env: APPDATA \scriptcs" ,
24+ " $env: LOCALAPPDATA \scriptcs"
25+ )
26+
27+ $oldPaths | foreach {
28+ # Remove the old user-specific scriptcs folders.
29+ if (Test-Path $_ ) {
30+ Remove-Item $_ - Recurse - Force
31+ }
32+
33+ # Remove the user-specific path that got added in previous installs.
34+ # There's no Uninstall-ChocolateyPath yet so we need to do it manually.
35+ # https://github.com/chocolatey/chocolatey/issues/97
36+ $envPath = $env: PATH
37+ if ($envPath.ToLower ().Contains($_.ToLower ())) {
38+ $userPath = Get-EnvironmentVariable - Name ' Path' - Scope " User"
39+ if ($userPath ) {
40+ $actualPath = [System.Collections.ArrayList ]($userPath ).Split(" ;" )
41+ $actualPath.Remove ($_ )
42+ $newPath = $actualPath -Join " ;"
43+ Set-EnvironmentVariable - Name ' Path' - Value $newPath - Scope " User"
44+ }
45+ }
46+
47+ Write-Host " '$_ ' has been removed." - ForegroundColor DarkYellow
48+ }
49+ Update-SessionEnvironment
50+ # End upgrade handling.
51+
2152 Write-ChocolateySuccess ' scriptcs'
2253} catch {
2354 Write-ChocolateyFailure ' scriptcs' " $ ( $_.Exception.Message ) "
You can’t perform that action at this time.
0 commit comments