Skip to content

Commit 20bbc3e

Browse files
Refactor ConvertTo-NormalizedModulePath for improved readability and maintainability
1 parent 3c894b9 commit 20bbc3e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

scripts/Helpers.psm1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,9 @@ function ConvertTo-NormalizedModulePath {
9292
$Path = $Path.Replace('\', '/')
9393

9494
# Get only the first module path and normalize it
95-
$modulePath = ($env:PSModulePath -split [IO.Path]::PathSeparator | Where-Object { -not [string]::IsNullOrWhiteSpace($_) } | Select-Object -First 1).TrimEnd('\', '/').Replace('\', '/')
96-
95+
$modulePath = ($env:PSModulePath -split [IO.Path]::PathSeparator | Where-Object { -not [string]::IsNullOrWhiteSpace($_) } |
96+
Select-Object -First 1).TrimEnd('\', '/').Replace('\', '/')
97+
9798
if ($modulePath -and $Path -match [regex]::Escape($modulePath)) {
9899
# Remove the module path prefix
99100
$normalizedPath = $Path -replace [regex]::Escape($modulePath), ''

0 commit comments

Comments
 (0)