Skip to content

Commit

Permalink
Revered if Purge.IsPresent checks back to origional order
Browse files Browse the repository at this point in the history
  • Loading branch information
jrdnr committed Mar 22, 2019
1 parent d6d0275 commit 23b2ad8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions DSCResources/cChocoPackageInstall/cChocoPackageInstall.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,10 @@ function Get-ChocoInstalledPackage {
}
$ChocoInstallList = Join-Path -Path $ChocoInstallLP -ChildPath 'ChocoInstalled.xml'

if ( -not $Purge) {
if ($Purge) {
Remove-Item $ChocoInstallList -Force
$res = $true
} else {
$PackageCacheSec = (Get-Date).AddSeconds('-60')
if ( $PackageCacheSec -lt (Get-Item $ChocoInstallList -ErrorAction SilentlyContinue).LastWriteTime ) {
$res = Import-Clixml $ChocoInstallList
Expand All @@ -443,9 +446,6 @@ function Get-ChocoInstalledPackage {
$res | Export-Clixml -Path $ChocoInstallList
}
}
} else {
Remove-Item $ChocoInstallList -Force
$res = $true
}

Return $res
Expand All @@ -465,6 +465,9 @@ function Get-ChocoVersion {
$chocoVersion = Join-Path -Path $chocoInstallCache -ChildPath 'ChocoVersion.xml'

if ( -not $Purge) {
Remove-Item $chocoVersion -Force
$res = $true
} else {
$cacheSec = (Get-Date).AddSeconds('-60')
if ( $cacheSec -lt (Get-Item $chocoVersion -ErrorAction SilentlyContinue).LastWriteTime ) {
$res = Import-Clixml $chocoVersion
Expand All @@ -473,9 +476,6 @@ function Get-ChocoVersion {
$res = [System.Version]($cmd.Split('-')[0])
$res | Export-Clixml -Path $chocoVersion
}
} else {
Remove-Item $chocoVersion -Force
$res = $true
}
Return $res
}
Expand Down

0 comments on commit 23b2ad8

Please sign in to comment.