Skip to content

Commit

Permalink
Fix version comparison with xx.x format (instead of xx.x.x)
Browse files Browse the repository at this point in the history
  • Loading branch information
ltguillaume committed Feb 12, 2022
1 parent edb5b6c commit ceb7244
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions LibreWolf-WinUpdater.ahk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; LibreWolf WinUpdater - https://github.com/ltGuillaume/LibreWolf-WinUpdater
;@Ahk2Exe-SetFileVersion 1.2.1
;@Ahk2Exe-SetFileVersion 1.2.2

;@Ahk2Exe-Bin Unicode 64*
;@Ahk2Exe-SetDescription LibreWolf WinUpdater
Expand Down Expand Up @@ -79,8 +79,12 @@ If !File

; Compare versions
ReleaseInfo := File.Read(64)
;MsgBox, Release = %ReleaseInfo% | Version = %CurrentVersion%
If InStr(ReleaseInfo, """v" CurrentVersion """") {
RegExMatch(ReleaseInfo, "i)Release v(.+?)""", Release)
StrReplace(Release1, ".",, DotCount)
If DotCount < 2
Release1 := Release1 ".0"
;MsgBox, ReleaseInfo = %ReleaseInfo%`nCurrentVersion = %CurrentVersion%`nRelease1 = %Release1%
If (Release1 = CurrentVersion) {
IniWrite, %_NoNewVersion%, %IniFile%, Log, LastResult
Exit
}
Expand All @@ -96,7 +100,7 @@ If ErrorLevel {
; Get setup file URL
Download := File.Read(4096)
FilenameEnd := IsPortable ? "win64.zip" : "setup.exe"
RegExMatch(Download, "i)" FilenameEnd """,""url"":""(\Qhttps://gitlab.com/librewolf-community/browser/windows/uploads/\E.*?\/(librewolf-.*?" FilenameEnd "))", DownloadUrl)
RegExMatch(Download, "i)" FilenameEnd """,""url"":""(\Qhttps://gitlab.com/librewolf-community/browser/windows/uploads/\E.+?\/(librewolf-.+?" FilenameEnd "))", DownloadUrl)
;MsgBox, Downloading`n%DownloadUrl1%`nto`n%DownloadUrl2%
If !DownloadUrl1 Or !DownloadUrl2
Die(_FindUrlError)
Expand All @@ -109,7 +113,7 @@ If !FileExist(SetupFile)

; Get checksum file
ChecksumFile = LibreWolf-Checksum.txt
RegExMatch(Download, "i)sha256sums.txt"",""url"":""(\Qhttps://gitlab.com/librewolf-community/browser/windows/uploads/\E.*?/sha256sums\.txt)", ChecksumUrl)
RegExMatch(Download, "i)sha256sums.txt"",""url"":""(\Qhttps://gitlab.com/librewolf-community/browser/windows/uploads/\E.+?/sha256sums\.txt)", ChecksumUrl)
If !ChecksumUrl1
Die(_FindSumsUrlError)
UrlDownloadToFile, %ChecksumUrl1%, %ChecksumFile%
Expand Down

0 comments on commit ceb7244

Please sign in to comment.