Skip to content

Commit

Permalink
Showing 2 changed files with 18 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/chocolatey.resources/helpers/chocolateyInstaller.psm1
Original file line number Diff line number Diff line change
@@ -48,7 +48,19 @@ if (Test-Path($extensionsPath)) {
Write-Debug 'Loading community extensions'
#Resolve-Path $extensionsPath\**\*\*.psm1 | % { Write-Debug "Importing `'$_`'"; Import-Module $_.ProviderPath }
Get-ChildItem $extensionsPath -recurse -filter "*.psm1" | Select -ExpandProperty FullName | % { Write-Debug "Importing `'$_`'"; Import-Module $_; }
Get-ChildItem $extensionsPath -recurse -filter "*.dll" | Select -ExpandProperty FullName | % { Write-Debug "Importing `'$_`'"; Import-Module $_; }
Get-ChildItem $extensionsPath -recurse -filter "*.dll" | Select -ExpandProperty FullName | % {
$path = $_;
try {
Write-Debug "Importing '$path'";
Import-Module $path;
} catch {
if ($env:ChocolateyPowerShellHost -eq 'true') {
Write-Warning "Import failed for '$path'. Error: '$_'"
} else {
Write-Warning "Import failed for '$path'. If it depends on a newer version of the .NET framework, please make sure you are using the built-in PowerShell Host. Error: '$_'"
}
}
}
}

Export-ModuleMember -Function * -Alias * -Cmdlet *
Original file line number Diff line number Diff line change
@@ -414,6 +414,11 @@ public static void set_environment_variables(ChocolateyConfiguration config)
Environment.SetEnvironmentVariable("chocolateyProxyLocation", config.Proxy.Location);
}

if (config.Features.UsePowerShellHost)
{
Environment.SetEnvironmentVariable("ChocolateyPowerShellHost", "true");
}

if (config.Information.LicenseIsValid)
{
Environment.SetEnvironmentVariable("ChocolateyLicenseValid", "true");

0 comments on commit 311c556

Please sign in to comment.