19
19
#define ELIXIR_CSV_URL ' https://elixir-lang.org/elixir.csv'
20
20
#define ERLANG_CSV_URL ' https://elixir-lang.org/erlang.csv'
21
21
22
- #include <idp.iss>
23
-
24
22
[Setup]
25
23
AppName = Elixir
26
24
AppVersion = 2.2
@@ -97,6 +95,7 @@ Name: "defer"; Description: "Defer installation (advanced)"; Flags: unchecked
97
95
98
96
var
99
97
GlobalPageSelRelease: TInputOptionWizardPage;
98
+ GlobalPageDownload: TDownloadWizardPage;
100
99
101
100
GlobalElixirReleases: array of TElixirRelease;
102
101
GlobalErlangData: TErlangData;
@@ -130,21 +129,6 @@ begin
130
129
131
130
if IsTaskSelected(' unins_previous' ) then
132
131
ExecAsOriginalUser(GetPreviousUninsExe, ' /SILENT' , ' ' , SW_SHOW, ewWaitUntilTerminated, _int);
133
-
134
- with GlobalErlangData do begin
135
- if IsTaskSelected(' erlang\32' ) then
136
- // 32-bit OTP needs to be downloaded before it's installed
137
- idpAddFile(URL32, Tmp(Exe32));
138
- if IsTaskSelected(' erlang\64' ) then
139
- // 64-bit OTP needs to be downloaded before it's installed
140
- idpAddFile(URL64, Tmp(Exe64));
141
- end ;
142
-
143
- // Download the Precompiled.zip archive for the selected release
144
- idpAddFile(CacheSelectedRelease.URL, Tmp(' Precompiled.zip' ));
145
-
146
- // Put the downloader page directly after this page
147
- idpDownloadAfter(wpPreparing);
148
132
end ;
149
133
end ;
150
134
@@ -155,14 +139,40 @@ var
155
139
begin
156
140
Result := True;
157
141
158
- // Search for the selected release
159
142
if CurPageID = GlobalPageSelRelease.ID then begin
143
+ // Search for the selected release
160
144
for i := 0 to GlobalPageSelRelease.CheckListBox.Items.Count - 1 do begin
161
145
if GlobalPageSelRelease.CheckListBox.Checked[i] then begin
162
146
CacheSelectedRelease := GlobalElixirReleases[i];
163
147
break;
164
148
end ;
165
149
end ;
150
+ end else if CurPageID = wpReady then begin
151
+ GlobalPageDownload.Clear;
152
+ with GlobalErlangData do begin
153
+ if IsTaskSelected(' erlang\32' ) then
154
+ // 32-bit OTP needs to be downloaded before it's installed
155
+ GlobalPageDownload.Add(URL32, Exe32, ' ' );
156
+ if IsTaskSelected(' erlang\64' ) then
157
+ // 64-bit OTP needs to be downloaded before it's installed
158
+ GlobalPageDownload.Add(URL64, Exe64, ' ' );
159
+ end ;
160
+
161
+ // Download the Precompiled.zip archive for the selected release
162
+ GlobalPageDownload.Add(CacheSelectedRelease.URL, ' Precompiled.zip' , ' ' );
163
+
164
+ // Run page
165
+ GlobalPageDownload.Show;
166
+ try
167
+ try
168
+ GlobalPageDownload.Download;
169
+ except
170
+ MsgBox(GetExceptionMessage, mbCriticalError, MB_OK);
171
+ Result := False;
172
+ end
173
+ finally
174
+ GlobalPageDownload.Hide;
175
+ end ;
166
176
end ;
167
177
end ;
168
178
@@ -198,6 +208,8 @@ begin
198
208
latest := False;
199
209
end
200
210
end ;
211
+
212
+ GlobalPageDownload := CreateDownloadPage(SetupMessage(msgWizardPreparing), SetupMessage(msgPreparingDesc), Nil );
201
213
end ;
202
214
203
215
function InitializeSetup (): Boolean;
@@ -209,14 +221,18 @@ begin
209
221
GlobalErlangCSVFilePath := Tmp(GetURLFilePart(' {#ERLANG_CSV_URL}' ));
210
222
211
223
// Download elixir.csv; show an error message and exit the installer if downloading fails
212
- if not idpDownloadFile(' {#ELIXIR_CSV_URL}' , GlobalElixirCSVFilePath) then begin
213
- MsgBox(' Error: Downloading {#ELIXIR_CSV_URL} failed. Setup cannot continue.' , mbInformation, MB_OK);
224
+ try
225
+ DownloadTemporaryFile(' {#ELIXIR_CSV_URL}' , GetURLFilePart(' {#ELIXIR_CSV_URL}' ), ' ' , Nil );
226
+ except
227
+ MsgBox(' {#ELIXIR_CSV_URL} - ' + GetExceptionMessage + ' . Setup cannot continue.' , mbInformation, MB_OK);
214
228
Result := False;
215
229
exit;
216
230
end ;
217
231
// Download erlang.csv; show an error message and exit the installer if downloading fails
218
- if not idpDownloadFile(' {#ERLANG_CSV_URL}' , GlobalErlangCSVFilePath) then begin
219
- MsgBox(' Error: Downloading {#ERLANG_CSV_URL} failed. Setup cannot continue.' , mbInformation, MB_OK);
232
+ try
233
+ DownloadTemporaryFile(' {#ERLANG_CSV_URL}' , GetURLFilePart(' {#ERLANG_CSV_URL}' ), ' ' , Nil );
234
+ except
235
+ MsgBox(' {#ERLANG_CSV_URL} - ' + GetExceptionMessage + ' . Setup cannot continue.' , mbInformation, MB_OK);
220
236
Result := False;
221
237
exit;
222
238
end ;
0 commit comments