Selaa lähdekoodia

Issue 2452: Check for wget failing

tags/0.6.3m1rc1
Michael 15 vuotta sitten
vanhempi
commit
ee84b2a5bc
1 muutettua tiedostoa jossa 26 lisäystä ja 14 poistoa
  1. 26
    14
      installer/windows/Setup.dpr

+ 26
- 14
installer/windows/Setup.dpr Näytä tiedosto

1
 {*
1
 {*
2
  * This application launches the dmdirc java-based installer.
2
  * This application launches the dmdirc java-based installer.
3
- * 
3
+ *
4
  * DMDirc - Open Source IRC Client
4
  * DMDirc - Open Source IRC Client
5
  * Copyright (c) 2006-2009 Chris Smith, Shane Mc Cormack, Gregory Holmes
5
  * Copyright (c) 2006-2009 Chris Smith, Shane Mc Cormack, Gregory Holmes
6
- * 
6
+ *
7
  * Permission is hereby granted, free of charge, to any person obtaining a copy
7
  * Permission is hereby granted, free of charge, to any person obtaining a copy
8
  * of this software and associated documentation files (the "Software"), to deal
8
  * of this software and associated documentation files (the "Software"), to deal
9
  * in the Software without restriction, including without limitation the rights
9
  * in the Software without restriction, including without limitation the rights
10
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
  * copies of the Software, and to permit persons to whom the Software is
11
  * copies of the Software, and to permit persons to whom the Software is
12
  * furnished to do so, subject to the following conditions:
12
  * furnished to do so, subject to the following conditions:
13
- * 
13
+ *
14
  * The above copyright notice and this permission notice shall be included in
14
  * The above copyright notice and this permission notice shall be included in
15
  * all copies or substantial portions of the Software.
15
  * all copies or substantial portions of the Software.
16
- * 
16
+ *
17
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
60
 // {$DEFINE LAZARUS}
60
 // {$DEFINE LAZARUS}
61
 // {$UNDEF LAZARUS}
61
 // {$UNDEF LAZARUS}
62
 
62
 
63
-uses 
63
+//{$DEFINE FORCEJREDOWNLOAD}
64
+
65
+uses
64
 	{$IFDEF LAZARUS}Interfaces, Forms, ComCtrls, Buttons, Messages, Controls, StdCtrls, {$ENDIF}
66
 	{$IFDEF LAZARUS}Interfaces, Forms, ComCtrls, Buttons, Messages, Controls, StdCtrls, {$ENDIF}
65
 	Vista, Windows, SysUtils, classes, registry, strutils {$IFNDEF FPC},masks{$ENDIF};
67
 	Vista, Windows, SysUtils, classes, registry, strutils {$IFNDEF FPC},masks{$ENDIF};
66
 
68
 
293
 	dir := IncludeTrailingPathDelimiter(ExtractFileDir(paramstr(0)));
295
 	dir := IncludeTrailingPathDelimiter(ExtractFileDir(paramstr(0)));
294
 	url := 'http://www.dmdirc.com/getjava/windows/all';
296
 	url := 'http://www.dmdirc.com/getjava/windows/all';
295
 	Result := false;
297
 	Result := false;
296
-	ExecAndWait('wget.exe -o '+dir+'wgetoutput --spider '+url, true);
297
-	
298
+	ExecAndWait('wget.exe -o "'+dir+'wgetoutput" --spider '+url, true);
299
+
300
+  if not fileexists(dir+'wgetoutput') then begin
301
+    showerror('Internal error: wget returned no output.');
302
+    result := false;
303
+    exit;
304
+  end;
298
 	AssignFile(f, dir+'wgetoutput');
305
 	AssignFile(f, dir+'wgetoutput');
299
 	Reset(f);
306
 	Reset(f);
300
 	line := '';
307
 	line := '';
385
 		if not isUpgrade then question := 'Java was not detected on your machine. Would you like to install it now?'
392
 		if not isUpgrade then question := 'Java was not detected on your machine. Would you like to install it now?'
386
 		else question := 'The version of java detected on your machine is not compatible with DMDirc. Would you like to install a compatible version now?';
393
 		else question := 'The version of java detected on your machine is not compatible with DMDirc. Would you like to install a compatible version now?';
387
 	end;
394
 	end;
388
-	
395
+
389
 	canContinue := true;
396
 	canContinue := true;
390
 	if (needDownload) then begin
397
 	if (needDownload) then begin
391
 		canContinue := downloadJRE(question);
398
 		canContinue := downloadJRE(question);
421
 		writeln('');
428
 		writeln('');
422
 		writeln('Please wait whilst the GUI part of the installer loads...');
429
 		writeln('Please wait whilst the GUI part of the installer loads...');
423
 		writeln('-----------------------------------------------------------------------');
430
 		writeln('-----------------------------------------------------------------------');
424
-//	end
425
-//	else begin
426
-//		errorMessage := 'This will install DMDirc on your computer, please click OK to continue, or Cancel to abort.';
427
-//		if (MessageBox(0, PChar(errorMessage), 'DMDirc Installer', MB_OKCANCEL + MB_ICONINFORMATION) <> IDOK) then begin
428
-//			exit;
429
-//		end;
431
+	//end
432
+	//else begin
433
+	//	errorMessage := 'This will install DMDirc on your computer, please click OK to continue, or Cancel to abort.';
434
+	//	if (MessageBox(0, PChar(errorMessage), 'DMDirc Installer', MB_OKCANCEL + MB_ICONINFORMATION) <> IDOK) then begin
435
+	//		exit;
436
+	//	end;
430
 	end;
437
 	end;
438
+
431
 	errorMessage := '';
439
 	errorMessage := '';
432
 	dowrite('Checking for DMDirc.jar.. ');
440
 	dowrite('Checking for DMDirc.jar.. ');
433
 	if FileExists('DMDirc.jar') then begin
441
 	if FileExists('DMDirc.jar') then begin
434
 		dowriteln('Success!');
442
 		dowriteln('Success!');
435
 		dowrite('Checking for JVM.. ');
443
 		dowrite('Checking for JVM.. ');
444
+    {$IFDEF FORCEJREDOWNLOAD}
445
+		if (1 <> 0) then begin
446
+    {$ELSE}
436
 		if (ExecAndWait(javaCommand+' -version') <> 0) then begin
447
 		if (ExecAndWait(javaCommand+' -version') <> 0) then begin
448
+    {$ENDIF}
437
 			dowriteln('Failed!');
449
 			dowriteln('Failed!');
438
 			if not installJRE(false) then begin
450
 			if not installJRE(false) then begin
439
 				showError('DMDirc setup can not continue without java. Please install java and try again', false, false);
451
 				showError('DMDirc setup can not continue without java. Please install java and try again', false, false);

Loading…
Peruuta
Tallenna