@@ -53,8 +53,8 @@ Source: "compiler:SetupLdr.e32"; DestDir: "{tmp}\_offlineinstaller"; Flags: dele
53
53
54
54
[Run]
55
55
Filename : " 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..."
58
58
59
59
[Code]
60
60
type
64
64
PSelInstallType: TInputOptionWizardPage;
65
65
PSelRelease: TWizardPage;
66
66
PSelReleaseListBox: TNewCheckListBox;
67
+
68
+ TargetRelease: TStrings;
69
+
67
70
i: Integer;
68
71
_int: Integer;
69
72
94
97
Result := SplitStringRec(Str, Delim, TStringList.Create);
95
98
end ;
96
99
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
+
97
120
function CSVToStringTable (Filename: String): TStringTable;
98
121
var
99
122
Rows: TArrayOfString;
@@ -109,18 +132,24 @@ end;
109
132
procedure PopulatePSelReleaseListBox (StringTable: TStringTable);
110
133
var
111
134
SelectFirst: Boolean;
135
+ ReleaseDesc: String;
112
136
begin
113
137
PSelReleaseListBox.Items.Clear;
114
138
SelectFirst := True;
115
139
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]);
118
147
SelectFirst := False;
119
148
end ;
120
149
end ;
121
150
end ;
122
151
123
- function GetSelectedReleaseValues (): TStrings;
152
+ function GetListBoxSelectedRelease (): TStrings;
124
153
begin
125
154
for i := 0 to PSelReleaseListBox.Items.Count - 1 do begin
126
155
if PSelReleaseListBox.Checked[i] then begin
@@ -130,14 +159,20 @@ begin
130
159
end ;
131
160
end ;
132
161
133
- function GetSelectedReleaseVersion (Param: String ): String ;
162
+ function GetListBoxLatestRelease (Prerelease: Boolean ): TStrings ;
134
163
begin
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 ;
136
171
end ;
137
172
138
- function GetSelectedReleaseURL ( ): String;
173
+ function ConstGetTargetReleaseVersion (Param: String ): String;
139
174
begin
140
- Result := GetSelectedReleaseValues[ 1 ] ;
175
+ Result := GetVersion(TargetRelease) ;
141
176
end ;
142
177
143
178
function ErlangIsInstalled : Boolean;
147
182
148
183
procedure CurPageChanged (CurPageID: Integer);
149
184
begin
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' ));
152
187
idpDownloadAfter(wpPreparing);
153
188
end ;
154
189
end ;
@@ -177,6 +212,7 @@ begin
177
212
PSelReleaseListBox.Parent := PSelRelease.Surface;
178
213
179
214
PopulatePSelReleaseListBox(CSVToStringTable(ExpandConstant(' {tmp}\releases.csv' )));
215
+ TargetRelease := GetListBoxLatestRelease(False);
180
216
end ;
181
217
182
218
function InitializeSetup (): Boolean;
0 commit comments