Skip to content

Commit ddf8304

Browse files
committed
fix nightly handling
1 parent 5d948e0 commit ddf8304

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/Versions.ps1

+5-5
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,10 @@ function Get-InstalledVersion {
5757
if (Test-Path $appPath -PathType Container) {
5858
# TODO: Keep only scoop-install.json
5959
$arr = @((Get-ChildItem "$appPath\*\install.json"), (Get-ChildItem "$appPath\*\scoop-install.json"))
60-
$result = ($arr | Sort-Object -Property LastWriteTimeUtc).Directory.Name -ne 'current'
60+
$versions = @(($arr | Sort-Object -Property LastWriteTimeUtc).Directory.Name)
61+
$result = $versions | Where-Object { $_ -ne 'current' } | Where-Object { $_ -notlike '_*.old*' }
6162
}
6263

63-
# Edge case when there is only 'current'
64-
if ($result -is [bool]) { $result = @() }
65-
6664
return $result
6765
}
6866
}
@@ -91,8 +89,10 @@ function Select-CurrentVersion {
9189

9290
if (Test-Path "$appPath\current" -PathType Container) {
9391
$currentVersion = (installed_manifest $AppName 'current' $Global).version
92+
# Get version from link target in case of nightly
93+
if ($currentVersion -eq 'nightly') { $currentVersion = ((Get-Item "$appPath\current").Target | Get-Item).BaseName }
9494
} else {
95-
$installedVersion = Get-InstalledVersion -AppName $AppName -Global:$Global
95+
$installedVersion = @(Get-InstalledVersion -AppName $AppName -Global:$Global)
9696
$currentVersion = if ($installedVersion) { $installedVersion[-1] } else { $null }
9797
}
9898

0 commit comments

Comments
 (0)