diff --git a/scoop/profile.d/smart-refresh-on-startup.ps1 b/scoop/profile.d/smart-refresh-on-startup.ps1 index 4182e97..02886a9 100644 --- a/scoop/profile.d/smart-refresh-on-startup.ps1 +++ b/scoop/profile.d/smart-refresh-on-startup.ps1 @@ -1,20 +1,6 @@ -$local:whenLast = $null -$local:whenLastSavePath = $(Join-Path $env:SCOOP last-scoop-refresh.clixml) - -if( Test-Path $whenLastSavePath ) { - $whenLast = Import-Clixml -LiteralPath $whenLastSavePath -} - -if( $whenLast ) { - $local:TimePassed = (Get-Date) - $local:whenLast - if( $TimePassed.TotalHours -ge 3 ) { - $whenLast = $null - } else { - Write-Host -ForegroundColor Yellow "Only $(ConvertFrom-TimeSpan $TimePassed) has passed, skipping scoop refresh." - } -} - -if( -not $whenLast ) { +if( Test-Path (Join-Path $env:SCOOP last-scoop-refresh.clixml) ) { scoop refresh - $whenLast | Export-Clixml -LiteralPath $whenLastSavePath +} else { + Write-Warning ("No recorded time for last 'scoop refresh', to remedy, run 'scoop refresh' at least once manually." + + "`nIf the issue still persists, please run 'scoop alias-update' to update to latest refresh code, and try again.") } \ No newline at end of file