Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(#2078) Skip importing Chocolatey GUI Extension #2230

Merged
merged 2 commits into from
Apr 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions src/chocolatey.resources/helpers/chocolateyInstaller.psm1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright © 2017 Chocolatey Software, Inc.
# Copyright © 2017 Chocolatey Software, Inc.
# Copyright © 2015 - 2017 RealDimensions Software, LLC
# Copyright © 2011 - 2015 RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey
#
Expand Down Expand Up @@ -40,11 +40,11 @@ Write-Debug "Host version is $($host.Version), PowerShell Version is '$($PSVersi
Get-Item $helpersPath\functions\*.ps1 |
? { -not ($_.Name.Contains(".Tests.")) } |
% {
. $_.FullName;
#Export-ModuleMember -Function $_.BaseName
. $_.FullName;
#Export-ModuleMember -Function $_.BaseName
}

# Export built-in functions prior to loading extensions so that
# Export built-in functions prior to loading extensions so that
# extension-specific loading behavior can be used based on built-in
# functions. This allows those overrides to be much more deterministic
# This behavior was broken from v0.9.9.5 - v0.10.3.
Expand All @@ -66,14 +66,18 @@ if (Test-Path($extensionsPath)) {
Write-Debug "Loading '$fileNameWithoutExtension' extension.";
$loaded = $false
$currentAssemblies | % {
$name = $_.GetName().Name
if ($name -eq $fileNameWithoutExtension) {
Import-Module $_
$loaded = $true
$name = $_.GetName().Name
if ($name -eq $fileNameWithoutExtension) {
Import-Module $_
$loaded = $true
}
}
}

if (!$loaded) { Import-Module $path; }
if (!$loaded) {
if ($fileNameWithoutExtension -ne "chocolateygui.licensed") {
Import-Module $path;
}
}
} catch {
if ($env:ChocolateyPowerShellHost -eq 'true') {
Write-Warning "Import failed for '$path'. Error: '$_'"
Expand Down