@@ -53,8 +53,8 @@ Source: "compiler:SetupLdr.e32"; DestDir: "{tmp}\_offlineinstaller"; Flags: dele
5353
5454[Run]
5555Filename : " powershell.exe" ; Parameters : " -File {tmp} \extract-zip.ps1 {tmp} \Precompiled.zip {tmp} \_offlineinstaller\elixir" ; Flags : waituntilterminated runhidden ; StatusMsg : " Extracting precompiled package..."
56- Filename : " {tmp} \_offlineinstaller\ISCC.exe" ; Parameters : " /dElixirVersion={code:GetSelectedReleaseVersion } /dSkipPages /dNoCompression Elixir.iss" ; WorkingDir : " {tmp} \_offlineinstaller" ; Flags : waituntilterminated runhidden ; StatusMsg : " Preparing Elixir installer..."
57- Filename : " {tmp} \_offlineinstaller\Output\elixir-v{code:GetSelectedReleaseVersion }-setup.exe" ; Flags : nowait ; StatusMsg : " Running Elixir installer..."
56+ Filename : " {tmp} \_offlineinstaller\ISCC.exe" ; Parameters : " /dElixirVersion={code:ConstGetTargetReleaseVersion } /dSkipPages /dNoCompression Elixir.iss" ; WorkingDir : " {tmp} \_offlineinstaller" ; Flags : waituntilterminated runhidden ; StatusMsg : " Preparing Elixir installer..."
57+ Filename : " {tmp} \_offlineinstaller\Output\elixir-v{code:ConstGetTargetReleaseVersion }-setup.exe" ; Flags : nowait ; StatusMsg : " Running Elixir installer..."
5858
5959[Code]
6060type
6464 PSelInstallType: TInputOptionWizardPage;
6565 PSelRelease: TWizardPage;
6666 PSelReleaseListBox: TNewCheckListBox;
67+
68+ TargetRelease: TStrings;
69+
6770 i: Integer;
6871 _int: Integer;
6972
9497 Result := SplitStringRec(Str, Delim, TStringList.Create);
9598end ;
9699
100+ function GetVersion (Release: TStrings): String;
101+ begin
102+ Result := Release[0 ];
103+ end ;
104+
105+ function GetURL (Release: TStrings): String;
106+ begin
107+ Result := Release[1 ];
108+ end ;
109+
110+ function IsPrerelease (Release: TStrings): Boolean;
111+ begin
112+ Result := (Release[2 ] = ' prerelease' );
113+ end ;
114+
115+ function IsCompatibleForInstall (Release: TStrings): Boolean;
116+ begin
117+ Result := (StrToInt(Release[3 ]) = { #COMPAT_MASK} );
118+ end ;
119+
97120function CSVToStringTable (Filename: String): TStringTable;
98121var
99122 Rows: TArrayOfString;
@@ -109,18 +132,24 @@ end;
109132procedure PopulatePSelReleaseListBox (StringTable: TStringTable);
110133var
111134 SelectFirst: Boolean;
135+ ReleaseDesc: String;
112136begin
113137 PSelReleaseListBox.Items.Clear;
114138 SelectFirst := True;
115139 for i := 0 to GetArrayLength(StringTable) - 1 do begin
116- if (StrToInt(StringTable[i][3 ]) = { #COMPAT_MASK} ) then begin
117- PSelReleaseListBox.AddRadioButton(' Elixir version ' + StringTable[i][0 ], StringTable[i][2 ], 0 , SelectFirst, True, StringTable[i]);
140+ if IsCompatibleForInstall(StringTable[i]) then begin
141+ if IsPrerelease(StringTable[i]) then begin
142+ ReleaseDesc := ' Prerelease' ;
143+ end else begin
144+ ReleaseDesc := ' Release' ;
145+ end ;
146+ PSelReleaseListBox.AddRadioButton(' Elixir version ' + GetVersion(StringTable[i]), ReleaseDesc, 0 , SelectFirst, True, StringTable[i]);
118147 SelectFirst := False;
119148 end ;
120149 end ;
121150end ;
122151
123- function GetSelectedReleaseValues (): TStrings;
152+ function GetListBoxSelectedRelease (): TStrings;
124153begin
125154 for i := 0 to PSelReleaseListBox.Items.Count - 1 do begin
126155 if PSelReleaseListBox.Checked[i] then begin
@@ -130,14 +159,20 @@ begin
130159 end ;
131160end ;
132161
133- function GetSelectedReleaseVersion (Param: String ): String ;
162+ function GetListBoxLatestRelease (Prerelease: Boolean ): TStrings ;
134163begin
135- Result := GetSelectedReleaseValues[0 ];
164+ for i := 0 to PSelReleaseListBox.Items.Count - 1 do begin
165+ if Prerelease = IsPrerelease(TStrings(PSelReleaseListBox.ItemObject[i])) then begin
166+ Result := TStrings(PSelReleaseListBox.ItemObject[i]);
167+ break;
168+ end ;
169+ end ;
170+ Result := nil ;
136171end ;
137172
138- function GetSelectedReleaseURL ( ): String;
173+ function ConstGetTargetReleaseVersion (Param: String ): String;
139174begin
140- Result := GetSelectedReleaseValues[ 1 ] ;
175+ Result := GetVersion(TargetRelease) ;
141176end ;
142177
143178function ErlangIsInstalled : Boolean;
147182
148183procedure CurPageChanged (CurPageID: Integer);
149184begin
150- if CurPageID = wpReady then begin
151- idpAddFile(GetSelectedReleaseURL , ExpandConstant(' {tmp}\Precompiled.zip' ));
185+ if CurPageID = wpPreparing then begin
186+ idpAddFile(GetURL(TargetRelease) , ExpandConstant(' {tmp}\Precompiled.zip' ));
152187 idpDownloadAfter(wpPreparing);
153188 end ;
154189end ;
@@ -177,6 +212,7 @@ begin
177212 PSelReleaseListBox.Parent := PSelRelease.Surface;
178213
179214 PopulatePSelReleaseListBox(CSVToStringTable(ExpandConstant(' {tmp}\releases.csv' )));
215+ TargetRelease := GetListBoxLatestRelease(False);
180216end ;
181217
182218function InitializeSetup (): Boolean;
0 commit comments