Skip to content

Commit

Permalink
Merge pull request #2198 from AdmiringWorm/universal-usb-installer-fix
Browse files Browse the repository at this point in the history
(universal-usb-installer) Treat trailing character as a additional version number
  • Loading branch information
JPRuskin committed May 24, 2023
2 parents 5532a69 + 1983ffd commit a0ebc3d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions automatic/universal-usb-installer/update.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ function global:au_SearchReplace {
}
}
}

function Convert-CharacterToNumber {
param(
[Parameter(Mandatory)]
[char] $character
)

$newNum = ([int]$character) + 1

$newNum - [int]([char]'a')
}

function global:au_GetLatest {
$download_page = Invoke-WebRequest -Uri $releases -UseBasicParsing

Expand All @@ -27,6 +39,13 @@ function global:au_GetLatest {

$verRe = '[-]|\.exe$'
$version32 = $url32 -split "$verRe" | Select-Object -Last 1 -Skip 1

if ($version32 -match "^([\d\.]+)([a-z])$") {
$m1 = $Matches[1]
$num = Convert-CharacterToNumber $Matches[2]
$version32 = "${m1}$num"
}

@{
URL32 = $url32
Version = Get-FixVersion $version32 -OnlyFixBelowVersion $padVersionUnder
Expand Down

0 comments on commit a0ebc3d

Please sign in to comment.