chocolatey/chocolatey — Issue #80: during install, Initialize-ChocolateyPath, sets $env:ChocolateyInstall incorrectly
Author: jamesmanning
Created: 2012-03-09 18:57:33+00:00
State: open

When I ran the install today (the iex from the web page) I got an error near the end of the install and the powershell I ran it from ended up with the wrong value set in $env:ChocolateyInstall

Output: http://pastebin.com/raw.php?i=Ur3efL95

The cause (AFAICT) is line 238 of the chocolateysetup.psm1

Source location: https://github.com/chocolatey/chocolatey/blob/master/nuget/tools/chocolateysetup.psm1#L238

$env:ChocolateyInstall = $chocolateyExePath

That sets the env var to the bin subdir instead of the correct dir, so my powershell (after running the install) had this value:

C:\Chocolatey » $env:ChocolateyInstall
C:\Chocolatey\bin
C:\Chocolatey »

AFAICT Initialize-ChocolateyPath shouldn't be setting this env var and should stick with just PATH things.

It would seem to make more sense (AFAICT) to set that env var around line 120 after we've finished the if/else and we know the right path is in the $chocolateyPath variable, so we could write it then:

$env:ChocolateyInstall = $chocolateyPath