From 649b01ce1c5e08452209bc7b34d1a0fbc7195d3a Mon Sep 17 00:00:00 2001 From: Gal Szkolnik Date: Tue, 29 Jun 2021 15:06:01 -0400 Subject: [PATCH] scoop package support for [SessionData] was supposed to be added with [SessionData] commit --- scoop/profile.d/smart-refresh-on-startup.ps1 | 28 +++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/scoop/profile.d/smart-refresh-on-startup.ps1 b/scoop/profile.d/smart-refresh-on-startup.ps1 index 6d9446b..845e2d0 100644 --- a/scoop/profile.d/smart-refresh-on-startup.ps1 +++ b/scoop/profile.d/smart-refresh-on-startup.ps1 @@ -1,17 +1,19 @@ param([switch]$Force) -if( -not $global:ThisSeszion -or $Force ) { - $global:MyModulesWarning = @() +if( -not (Test-Path variable:global:ScoopRefreshed) ) { + scoop autocomplete-on +} +$global:ScoopRefreshed = [SessionData]::Get("ScoopRefreshed",$false) + +if( -not $ScoopRefreshed ) { + if( Test-Path (Join-Path $env:SCOOP last-scoop-refresh.clixml) ) { + if($Host.Name -ne 'Visual Studio Code Host' ) { + scoop refresh + [SessionData]::Set("ScoopRefreshed",$true) + } + } 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.") + } } - -scoop autocomplete-on - -if( Test-Path (Join-Path $env:SCOOP last-scoop-refresh.clixml) ) { - if($Host.Name -ne 'Visual Studio Code Host' ) { - scoop refresh - } -} 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