Winget-AutoUpdate icon indicating copy to clipboard operation
Winget-AutoUpdate copied to clipboard

Winget version with the now stable v1.3.2091

Open KnifMelti opened this issue 2 years ago • 5 comments

But now when I as a user runs winget --version: v1.3.2091

When WAU runs in System contrext: 13:22:47 - Winget Version: v1.3.0-preview

So, the Get-WingetCmd.ps1 doesn't detect the latest version:

#Get WinGet Path (if admin context)
$ResolveWingetPath = Resolve-Path "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe"
if ($ResolveWingetPath) {
    #If multiple version, pick last one
    $WingetPath = $ResolveWingetPath[-1].Path
}

I have two versions now:

2022-08-13  05:19    <DIR>          Microsoft.DesktopAppInstaller_1.18.2091.0_neutral_split.language-sv_8wekyb3d8bbwe
2022-08-13  05:19    <DIR>          Microsoft.DesktopAppInstaller_1.18.2091.0_neutral_split.scale-100_8wekyb3d8bbwe
2022-08-13  05:19    <DIR>          Microsoft.DesktopAppInstaller_1.18.2091.0_x64__8wekyb3d8bbwe
2022-06-09  20:36    <DIR>          Microsoft.DesktopAppInstaller_1.18.431.0_x64__8wekyb3d8bbwe
2022-08-13  05:19    <DIR>          Microsoft.DesktopAppInstaller_2022.728.1939.0_neutral_~_8wekyb3d8bbwe

Originally posted by @KnifMelti in https://github.com/Romanitho/Winget-AutoUpdate/discussions/61#discussioncomment-3389270

KnifMelti avatar Aug 13 '22 11:08 KnifMelti

...and that affects Winget-Install and Winget-Install-GUI too, or...?

KnifMelti avatar Aug 13 '22 19:08 KnifMelti

...I think this is the solution (?): $ResolveWingetPath = Resolve-Path "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe" | Sort-Object -Property {$_.Name -as [int]}

KnifMelti avatar Aug 15 '22 23:08 KnifMelti

not sure to understand -Property {$_.Name -as [int]}

Romanitho avatar Aug 17 '22 07:08 Romanitho

It sorts the array so that the 1.18.2091.0 is the last one, not 1.18.431.0 Try it out... Edit: changed it to -Property {$_.Path -as [int]}

KnifMelti avatar Aug 17 '22 08:08 KnifMelti

https://stackoverflow.com/questions/33664892/sort-directory-name-using-powershell#comment55103191_33664892

KnifMelti avatar Aug 17 '22 17:08 KnifMelti

yes, but in our case, i don't how it can work because the folder names are not "integers"

Romanitho avatar Aug 18 '22 07:08 Romanitho

No, but -as is the keyword, it seems to sort the string and then the numbers in the strin as INT...

KnifMelti avatar Aug 18 '22 09:08 KnifMelti

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Sep 18 '22 03:09 github-actions[bot]