Skip to content

Commit

Permalink
Fixed version check issue
Browse files Browse the repository at this point in the history
  • Loading branch information
maurizuki committed Aug 8, 2023
1 parent 9b56fa0 commit 1d3357e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion sf_net/upd8r.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<MajorVersion>2</MajorVersion>
<MinorVersion>3</MinorVersion>
<Release>0</Release>
<Build>506</Build>
<Build>507</Build>
</AppVersion>
<DownloadURL>https://github.com/maurizuki/O2/releases/latest</DownloadURL>
</Update>
4 changes: 2 additions & 2 deletions src/O2/o2.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
<DCC_DependencyCheckOutputName>o2.exe</DCC_DependencyCheckOutputName>
<SanitizedProjectName>o2</SanitizedProjectName>
<VerInfo_Build>506</VerInfo_Build>
<VerInfo_Keys>CompanyName=The O2 Project;FileDescription=O2;FileVersion=2.3.0.506;InternalName=O2;LegalCopyright=(C) 2004-2023 Maurizio Basaglia. All rights reserved.;LegalTrademarks=;OriginalFilename=o2.exe;ProductName=O2;ProductVersion=2.3;Comments=A safe storage for your personal data.;Homepage=http://o2project.sourceforge.net</VerInfo_Keys>
<VerInfo_Build>507</VerInfo_Build>
<VerInfo_Keys>CompanyName=The O2 Project;FileDescription=O2;FileVersion=2.3.0.507;InternalName=O2;LegalCopyright=(C) 2004-2023 Maurizio Basaglia. All rights reserved.;LegalTrademarks=;OriginalFilename=o2.exe;ProductName=O2;ProductVersion=2.3;Comments=A safe storage for your personal data.;Homepage=http://o2project.sourceforge.net</VerInfo_Keys>
<BT_BuildType>Debug</BT_BuildType>
<VerInfo_Release>0</VerInfo_Release>
<VerInfo_MinorVer>3</VerInfo_MinorVer>
Expand Down
Binary file modified src/O2/o2.res
Binary file not shown.
15 changes: 8 additions & 7 deletions src/O2/uUtils.pas
Original file line number Diff line number Diff line change
Expand Up @@ -292,19 +292,20 @@ procedure TAppUpdate.SetAppVersion(const Value: TAppVersion);
procedure TAppUpdate.LoadFromJSON(const JSON: TJSONValue);
const
AppVersionPattern =
'^v(?<MajorVersion>[0-9]+)\.(?<MinorVersion>[0-9]+)\.(?<Release>[0-9]+)$';
'^v(?<MajorVersion>[0-9]+)\.(?<MinorVersion>[0-9]+)(?:\.(?<Release>[0-9]+))?$';
var
RegEx: TRegEx;
Match: TMatch;
begin
RegEx := TRegEx.Create(AppVersionPattern);
Match := RegEx.Match(JSON.GetValue<string>('tag_name'));
AppVersion.MajorVersion :=
StrToIntDef(Match.Groups['MajorVersion'].Value, 0);
AppVersion.MinorVersion :=
StrToIntDef(Match.Groups['MinorVersion'].Value, 0);
AppVersion.Release :=
StrToIntDef(Match.Groups['Release'].Value, 0);
AppVersion.MajorVersion := StrToInt(Match.Groups['MajorVersion'].Value);
AppVersion.MinorVersion := StrToInt(Match.Groups['MinorVersion'].Value);
try
AppVersion.Release := StrToIntDef(Match.Groups['Release'].Value, 0)
except
AppVersion.Release := 0;
end;
AppVersion.Build := 0;
DownloadURL := JSON.GetValue<string>('html_url');
end;
Expand Down

0 comments on commit 1d3357e

Please sign in to comment.