Skip to content

Commit 9366b56

Browse files
author
Andrew
committed
Updated cache code for WinPS
1 parent 32015c7 commit 9366b56

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

powershell-adapter/psDscAdapter/psDscAdapter.psm1

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,14 @@ function Invoke-DscCacheRefresh {
3939

4040
$refreshCache = $false
4141

42-
if ($IsWindows) {
43-
$cacheFilePath = Join-Path $env:LocalAppData "dscv3classcache.json"
42+
$cacheFileSuffix = ".json"
43+
if ($PSVersionTable.PSVersion.Major -le 5) {
44+
$cacheFileSuffix = "-v5.json"
4445
}
45-
else {
46-
$cacheFilePath = Join-Path $env:HOME ".dsc" "dscv3classcache.json"
46+
47+
$cacheFilePath = Join-Path $env:LocalAppData "dscv3classcache$cacheFileSuffix"
48+
if ($IsLinux -or $IsMacOS) {
49+
$cacheFilePath = Join-Path $env:HOME ".dsc" "dscv3classcache$cacheFileSuffix"
4750
}
4851

4952
if (Test-Path $cacheFilePath) {

0 commit comments

Comments
 (0)