From d90e0413fa273453be091a37da36c0ab5d439bcd Mon Sep 17 00:00:00 2001 From: Romain <96626929+Romanitho@users.noreply.github.com> Date: Mon, 7 Mar 2022 12:16:01 +0100 Subject: [PATCH] Minor change Get version when AutoUpdate is disabled --- Winget-AutoUpdate/winget-upgrade.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Winget-AutoUpdate/winget-upgrade.ps1 b/Winget-AutoUpdate/winget-upgrade.ps1 index b4bb3bc..95ceb1c 100644 --- a/Winget-AutoUpdate/winget-upgrade.ps1 +++ b/Winget-AutoUpdate/winget-upgrade.ps1 @@ -233,6 +233,10 @@ function Start-WAUUpdateCheck{ [xml]$UpdateStatus = Get-Content "$WorkingDir\config\config.xml" -Encoding UTF8 -ErrorAction SilentlyContinue $AutoUpdateStatus = $UpdateStatus.app.WAUautoupdate + #Get current installed version + [xml]$About = Get-Content "$WorkingDir\config\about.xml" -Encoding UTF8 -ErrorAction SilentlyContinue + [version]$CurrentVersion = $About.app.version + #Check if AutoUpdate is enabled if ($AutoUpdateStatus -eq $false){ Write-Log "WAU Current version: $CurrentVersion. AutoUpdate is disabled." "Cyan" @@ -245,10 +249,6 @@ function Start-WAUUpdateCheck{ $LatestVersion = (Invoke-WebRequest $WAUurl | ConvertFrom-Json)[0].tag_name [version]$AvailableVersion = $LatestVersion.Replace("v","") - #Get current installed version - [xml]$About = Get-Content "$WorkingDir\config\about.xml" -Encoding UTF8 -ErrorAction SilentlyContinue - [version]$CurrentVersion = $About.app.version - #If newer version is avalable, return $True if ($AvailableVersion -gt $CurrentVersion){ Write-Log "WAU Current version: $CurrentVersion. Version $AvailableVersion is available." "Yellow"