Skip to content

Commit 4652ef7

Browse files
author
Kapil Borle
committed
Add function to psm1 file to check PowerShell edition
1 parent ce01397 commit 4652ef7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Engine/PSScriptAnalyzer.psm1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
# Script module for module 'PSScriptAnalyzer'
33
#
44

5+
function Test-PSEditionCoreCLR
6+
{
7+
($PSVersionTable.Keys -contains "PSEdition") -and ($PSVersionTable.PSEdition -ne 'Desktop')
8+
}
9+
510
# Clear PSDefaultParameterValues in the module scope and enable strict mode
611
$PSDefaultParameterValues.Clear()
712
Set-StrictMode -Version Latest
@@ -14,7 +19,7 @@ $PSModuleRoot = $PSModule.ModuleBase
1419
$binaryModuleRoot = $PSModuleRoot
1520

1621

17-
if (($PSVersionTable.Keys -contains "PSEdition") -and ($PSVersionTable.PSEdition -ne 'Desktop')) {
22+
if ((Test-PSEditionCoreCLR)) {
1823
$binaryModuleRoot = Join-Path -Path $PSModuleRoot -ChildPath 'coreclr'
1924
}
2025
else

0 commit comments

Comments
 (0)