public/Get-ChocolateyInstallLocation.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
function Get-ChocolateyInstallLocation() {

    $chocolateyInstall = $Env:ChocolateyInstall
    if([string]::IsNullOrWhiteSpace($chocolateyInstall)) {
        $chocolateyInstall = Join-Path $env:ALLUSERSPROFILE "Chocolatey" 
    }

    if(-not (Test-Path $chocolateyInstall)) {
        $chocolateyInstall = Join-Path $env:SystemDrive "ProgramData" 
        $chocolateyInstall = Join-Path $chocolateyInstall "Chocolatey"
    }

    return $chocolateyInstall
}