@@ -60,8 +60,8 @@ function Invoke-DscCacheRefresh {
60
60
$namedModules = [System.Collections.Generic.List [Object ]]::new()
61
61
$cacheFilePath = Join-Path $env: LocalAppData " dsc\WindowsPSAdapterCache.json"
62
62
63
- # Reset PSModulePath to not contain empty entries
64
- Set -ValidPSModulePath
63
+ # Repair PSModulePath to not contain empty entries
64
+ Repair -ValidPSModulePath
65
65
66
66
if (Test-Path $cacheFilePath ) {
67
67
" Reading from Get-DscResource cache file $cacheFilePath " | Write-DscTrace
@@ -247,10 +247,10 @@ function Invoke-DscCacheRefresh {
247
247
}
248
248
249
249
$dscResourceCacheEntries.Add ([dscResourceCacheEntry ]@ {
250
- Type = " $moduleName /$ ( $dscResource.Name ) "
251
- DscResourceInfo = $DscResourceInfo
252
- LastWriteTimes = $lastWriteTimes
253
- })
250
+ Type = " $moduleName /$ ( $dscResource.Name ) "
251
+ DscResourceInfo = $DscResourceInfo
252
+ LastWriteTimes = $lastWriteTimes
253
+ })
254
254
}
255
255
256
256
if ($namedModules.Count -gt 0 ) {
@@ -704,15 +704,14 @@ function GetClassBasedCapabilities {
704
704
}
705
705
}
706
706
707
- function Set -ValidPSModulePath {
707
+ function Repair -ValidPSModulePath {
708
708
[CmdletBinding ()]
709
709
param ()
710
710
711
711
end {
712
712
if (($env: PSModulePath -split [System.IO.Path ]::PathSeparator) -contains ' ' ) {
713
713
" Removing empty entry from PSModulePath: '$env: PSModulePath '" | Write-DscTrace - Operation Debug
714
- $env: PSModulePath = ($env: PSModulePath -split [System.IO.Path ]::PathSeparator |
715
- Where-Object { $_ -ne ' ' }) -join [System.IO.Path ]::PathSeparator
714
+ $env: PSModulePath = [String ]::Join([System.IO.Path ]::PathSeparator, ($env: PSModulePath.Split ([System.IO.Path ]::PathSeparator, [System.StringSplitOptions ]::RemoveEmptyEntries)))
716
715
}
717
716
}
718
717
}
0 commit comments