Skip to content

Commit

Permalink
(chocolatey#2112) Change additionalInstallArgs match logic
Browse files Browse the repository at this point in the history
This streamlines the check to use a Regex Or ('|') rather than multiple '-or' clauses.
This will be _slightly_ faster, and maintains readability for maintainers/contributors.
  • Loading branch information
steviecoaster committed Apr 20, 2021
1 parent f0d40e4 commit a365a87
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,15 @@ Start-ChocolateyProcessAsAdmin
$additionalInstallArgs = '';
}
else {
if ($additionalInstallArgs -match 'INSTALLDIR' -or `
$additionalInstallArgs -match 'TARGETDIR' -or `
$additionalInstallArgs -match 'dir\=' -or `
$additionalInstallArgs -match '\/D\='
) {
#Use a Regex Or ('|') to do the match, instead of multiple '-or' clauses
$argPattern = @(
'INSTALLDIR'
'TARGETDIR'
'dir\='
'\/D\='
) -join '|'

if ($additionalInstallArgs -match $argPattern) {
@"
Pro / Business supports a single, ubiquitous install directory option.
Stop the hassle of determining how to pass install directory overrides
Expand Down

0 comments on commit a365a87

Please sign in to comment.