-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #112 from Redsandro/patch-3
Update PhantomJS to fix binRoot detection
- Loading branch information
Showing
2 changed files
with
42 additions
and
4 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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,35 @@ | |||
function Get-BinRoot { | |||
|
|||
# Since CamelCase was decided upon when $env:ChocolateyInstall was first invented, whe should stick to this convention and use $env:ChocolateyBinRoot. | |||
# I propose: | |||
# 1) all occurances of $env:chocolatey_bin_root be replaced with $env:ChocolateyBinRoot; | |||
# 2) Make the new Chocolatey Installer for new users explicitly set (if not exists) $env:ChocolateyInstall and $env:ChocolateyBinRoot as environment variables so users will smile and understand; | |||
# 3) Make new Chocolatey convert old $env:chocolatey_bin_root to $env:ChocolateyBinRoot | |||
|
|||
# For now, check old var first | |||
if($env:ChocolateyBinRoot -eq $null) { # If no value | |||
if($env:chocolatey_bin_root -eq $null) { # Try old var | |||
$binRoot = "$env:ChocolateyInstall\bin" | |||
} | |||
else { | |||
$env:ChocolateyBinRoot = $env:chocolatey_bin_root | |||
} | |||
} | |||
|
|||
# My ChocolateyBinRoot is C:\Common\bin, but looking at other packages, not everyone assumes ChocolateyBinRoot is prepended with a drive letter. | |||
if (-not($env:ChocolateyBinRoot -imatch "^\w:")) { | |||
# Add drive letter | |||
$binRoot = join-path $env:systemdrive $env:ChocolateyBinRoot | |||
} | |||
else { | |||
$binRoot = $env:ChocolateyBinRoot | |||
} | |||
|
|||
# Now that we figured out the binRoot, let's store it as per proposal #3 line #7 | |||
if(-not($env:ChocolateyBinRoot -eq $binRoot)) { | |||
[Environment]::SetEnvironmentVariable("ChocolateyBinRoot", "$binRoot", "User") | |||
# Note that user variables pose a problem when there are two admins on one computer. But this is what was decided upon. | |||
} | |||
|
|||
return $binRoot | |||
} |
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