From 53226f09b40066e65ab9f1db58c297b231cbf262 Mon Sep 17 00:00:00 2001 From: Gal Szkolnik Date: Sun, 7 Feb 2021 14:01:56 -0500 Subject: [PATCH] Moved logic to szcoop repo --- scoop/profile.d/smart-refresh-on-startup.ps1 | 22 ++++---------------- 1 file changed, 4 insertions(+), 18 deletions(-) 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