Skip to content

Commit

Permalink
weblocopener-57: trying fix 2
Browse files Browse the repository at this point in the history
  • Loading branch information
benchdoos committed Oct 28, 2023
1 parent ccf8bc4 commit 8d42ad8
Showing 1 changed file with 38 additions and 6 deletions.
44 changes: 38 additions & 6 deletions build/WeblocOpener.iss
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,35 @@ DisableDirPage=no

;https://github.com/HeliumProject/InnoSetup/blob/master/Examples/CodeExample1.iss
[Code]
function GetSecondPartIfContainsPeriod(input: string): string;
var
parts: TArrayOfString;
begin
// Check if the input string contains a period
if Pos('.', input) > 0 then
begin
// Split the string by the period
parts := StringSplit(input, '.');
// Ensure there are at least two parts
if Length(parts) >= 2 then
begin
// Return the second part
Result := parts[1];
end
else
begin
// There is only one part, return the original string
Result := input;
end;
end
else
begin
// No period found, return the original string
Result := input;
end;
end;
function GetJavaMajorVersion(): integer;
var
TempFile: string;
Expand Down Expand Up @@ -82,12 +111,15 @@ begin
Log(Format('Extracted version: %s', [S]));
{ extract major }
if Copy(S, 1, 2) = '1.' then
begin
Delete(S, 1, 2);
end;
P := Pos('.', S);
SetLength(S, P - 2);
S := GetSecondPartIfContainsPeriod(S);
//if Copy(S, 1, 2) = '1.' then
//begin
// Delete(S, 1, 2);
//end;
//P := Pos('.', S);
//SetLength(S, P - 2);
Log(Format('Major version: %s', [S]));
Result := StrToIntDef(S, 0);
Expand Down

0 comments on commit 8d42ad8

Please sign in to comment.