majkinetor / au-packages

Chocolatey packages by majkinetor
https://gist.github.com/majkinetor/a700c70b8847b29ebb1c918d47ee4eb1
GNU General Public License v2.0
66 stars 45 forks source link

yed should not use $env:chocolatey_bin_root #7

Closed majkinetor closed 8 years ago

majkinetor commented 8 years ago

@majkinetor $env:chocolatey_bin_root was not official and is deprecated for $env:ChocolateyBinRoot, both of which are adjusted to $env:ChocolateyToolsRoot in 0.9.10. You should only ever rely on it by using Get-BinRoot

Rob Reynolds @ferventcoder Jun 04 17:11 @majkinetor aliases are not working in autodoc - but this is now the name for Get-BinRoot (calling the old still works) - https://chocolatey.org/docs/helpers-get-tools-location @majkinetor so no, you can never rely on the environment variable directly - always use Get-BinRoot

Rob Reynolds @ferventcoder 15:07 @majkinetor check for $env:ChocolateyBinRoot - see what it is set to. It sounds like something weird is going on in your environment - the 0.9.9 series would not allow just c:\

majkinetor commented 8 years ago

$env:ChocolateyToolsRoot is set to c:\tools here so it doesn't help.

I finished by hardcoding bin part:

$cmdPath = join-path $env:ChocolateyInstall bin\yed.cmd

majkinetor commented 8 years ago

This is the method used in installer: https://chocolatey.org/install.ps1

Write-Output 'Ensuring chocolatey commands are on the path'
$chocInstallVariableName = "ChocolateyInstall"
$chocoPath = [Environment]::GetEnvironmentVariable($chocInstallVariableName)
if ($chocoPath -eq $null -or $chocoPath -eq '') {
  $chocoPath = 'C:\ProgramData\Chocolatey'
}

$chocoExePath = Join-Path $chocoPath 'bin'
ferventcoder commented 8 years ago

$cmdPath = join-path $env:ChocolateyInstall 'bin\yed.cmd'

This is correct - when the path you are looking for is the Chocolatey Install bin folder, it is not the binroot var. You do just as you have done above 👍