@@ -56,50 +56,53 @@ begin
5656 LatestRelease := True;
5757
5858 // Read the file at Filename and store the lines in Rows
59- LoadStringsFromFile(Filename, Rows);
60- // Match length of return array to number of rows
61- SetArrayLength(Result, GetArrayLength(Rows) - 1 );
59+ if LoadStringsFromFile(Filename, Rows) then begin
60+ // Match length of return array to number of rows
61+ SetArrayLength(Result, GetArrayLength(Rows) - 1 );
6262
63- for i := 1 to GetArrayLength(Rows) - 1 do begin
64- // Separate values at commas
65- RowValues := SplitString(Rows[i], ' ,' );
63+ for i := 1 to GetArrayLength(Rows) - 1 do begin
64+ // Separate values at commas
65+ RowValues := SplitString(Rows[i], ' ,' );
6666
67- with Result[i - 1 ] do begin
68- // Store first and second values as the Version and URL respectively
69- Version := RowValues[0 ];
70- URL := RowValues[1 ];
67+ with Result[i - 1 ] do begin
68+ // Store first and second values as the Version and URL respectively
69+ Version := RowValues[0 ];
70+ URL := RowValues[1 ];
7171
72- if StrToInt(RowValues[3 ]) = { #COMPAT_MASK} then begin
73- // Release has a compatibility mask matching this installer
74- if RowValues[2 ] = ' prerelease' then begin
75- // Release is designated as a prerelease
76- if LatestPrerelease then begin
77- // This is the first prerelease found, so it's the latest prerelease
78- ReleaseType := rtLatestPrerelease;
79- LatestPrerelease := False;
72+ if StrToInt(RowValues[3 ]) = { #COMPAT_MASK} then begin
73+ // Release has a compatibility mask matching this installer
74+ if RowValues[2 ] = ' prerelease' then begin
75+ // Release is designated as a prerelease
76+ if LatestPrerelease then begin
77+ // This is the first prerelease found, so it's the latest prerelease
78+ ReleaseType := rtLatestPrerelease;
79+ LatestPrerelease := False;
80+ end else begin
81+ // This is not the latest prerelease
82+ ReleaseType := rtPrerelease;
83+ end ;
8084 end else begin
81- // This is not the latest prerelease
82- ReleaseType := rtPrerelease;
85+ if LatestRelease then begin
86+ // This is the first release found, so it's the latest prerelease
87+ ReleaseType := rtLatestRelease;
88+ LatestRelease := False;
89+ end else begin
90+ // This is not the latest release
91+ ReleaseType := rtRelease;
92+ end ;
8393 end ;
8494 end else begin
85- if LatestRelease then begin
86- // This is the first release found, so it's the latest prerelease
87- ReleaseType := rtLatestRelease;
88- LatestRelease := False;
89- end else begin
90- // This is not the latest release
91- ReleaseType := rtRelease;
92- end ;
95+ // Release can't be installed by this installer
96+ ReleaseType := rtIncompatible;
9397 end ;
94- end else begin
95- // Release can't be installed by this installer
96- ReleaseType := rtIncompatible;
97- end ;
9898
99- // Assign this Elixir release a new reference object
100- if Ref = nil then
101- Ref := TObject.Create();
99+ // Assign this Elixir release a new reference object
100+ if Ref = nil then
101+ Ref := TObject.Create();
102+ end ;
102103 end ;
104+ end else begin
105+ SetArrayLength(Result, 0 );
103106 end ;
104107end ;
105108
0 commit comments