Browse Source

Move more calls to shared units and tidy source

tags/0.6.3m1rc1
Michael 15 years ago
parent
commit
dd0812c7eb

+ 0
- 36
installer/windows/Setup.dpr View File

@@ -211,41 +211,6 @@ begin
211 211
   applet.createwindow;
212 212
 end;
213 213
 
214
-{ ----------------------------------------------------------------------------
215
-  Launch a process (hidden if requested) and immediately return control to
216
-  the current thread
217
-  ---------------------------------------------------------------------------- }
218
-function Launch(sProgramToRun: String; hide: boolean = false): TProcessInformation;
219
-var
220
-  StartupInfo: TStartupInfo;
221
-begin
222
-  FillChar(StartupInfo, SizeOf(TStartupInfo), 0);
223
-  with StartupInfo do begin
224
-    cb := SizeOf(TStartupInfo);
225
-    dwFlags := STARTF_USESHOWWINDOW;
226
-    if hide then wShowWindow := SW_HIDE
227
-    else wShowWindow := SW_SHOWNORMAL;
228
-  end;
229
-
230
-  CreateProcess(nil, PChar(sProgramToRun), nil, nil, False, NORMAL_PRIORITY_CLASS, nil, nil, StartupInfo, Result);
231
-end;
232
-
233
-{ ----------------------------------------------------------------------------
234
-  Launch a process (hidden if requested) and wait for it to finish
235
-  ---------------------------------------------------------------------------- }
236
-function ExecAndWait(sProgramToRun: String; hide: boolean = false): Longword;
237
-var
238
-  ProcessInfo: TProcessInformation;
239
-begin
240
-  ProcessInfo := Launch(sProgramToRun, hide);
241
-  getExitCodeProcess(ProcessInfo.hProcess, Result);
242
-
243
-  while Result = STILL_ACTIVE do begin
244
-    sleep(1000);
245
-    GetExitCodeProcess(ProcessInfo.hProcess, Result);
246
-  end;
247
-end;
248
-
249 214
 { ----------------------------------------------------------------------------
250 215
   Return the size in bytes of the file specified by <name>
251 216
   Returns -1 on error
@@ -442,7 +407,6 @@ begin
442 407
 end;
443 408
 
444 409
 { ----------------------------------------------------------------------------
445
- 
446 410
   MAIN PROGRAM
447 411
   ---------------------------------------------------------------------------- }
448 412
 var

+ 46
- 70
installer/windows/Uninstaller.dpr View File

@@ -1,3 +1,31 @@
1
+{*
2
+ * DMDirc Uninstaller
3
+ *
4
+ * This application launches DMDirc on windows and passes control to the
5
+ * update engine as necessary.
6
+ *
7
+ * DMDirc - Open Source IRC Client
8
+ * Copyright (c) 2006-2009 Chris Smith, Shane Mc Cormack, Gregory Holmes,
9
+ * Michael Nixon
10
+ *
11
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ * of this software and associated documentation files (the "Software"), to deal
13
+ * in the Software without restriction, including without limitation the rights
14
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ * copies of the Software, and to permit persons to whom the Software is
16
+ * furnished to do so, subject to the following conditions:
17
+ *
18
+ * The above copyright notice and this permission notice shall be included in
19
+ * all copies or substantial portions of the Software.
20
+ *
21
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ * SOFTWARE.
28
+ *}
1 29
 program Uninstaller;
2 30
 {$IFDEF FPC}
3 31
 	{$MODE Delphi}
@@ -26,43 +54,15 @@ program Uninstaller;
26 54
 	{$ENDIF}
27 55
 {$ENDIF}
28 56
 
29
-uses Windows, SysUtils, registry, Vista;
57
+uses shared, Windows, SysUtils, registry, Vista;
58
+procedure InitCommonControls; stdcall; External 'comctl32.dll' name 'InitCommonControls';
30 59
 
31 60
 {$R uninstall.res}
61
+{ ---------------------------------------------------------------------------- }
32 62
 
33
-procedure InitCommonControls; stdcall; External 'comctl32.dll' name 'InitCommonControls'; 
34
-
35
-procedure dowriteln(line: String);
36
-begin
37
-	if IsConsole then writeln(line);
38
-end;
39
-
40
-procedure dowrite(line: String);
41
-begin
42
-	if IsConsole then write(line);
43
-end;
44
-
45
-function askQuestion(Question: String): boolean;
46
-begin
47
-	Result := TaskDialog(0, 'DMDirc Uninstaller', 'Question', Question, TD_ICON_QUESTION, TD_BUTTON_YES + TD_BUTTON_NO) = mrYes;
48
-end;
49
-
50
-procedure showError(context: String; ErrorMessage: String; addFooter: boolean = true);
51
-begin
52
-	if addFooter then begin
53
-		ErrorMessage := ErrorMessage+#13#10;
54
-		ErrorMessage := ErrorMessage+#13#10+' If you feel this is incorrect, or you require some further assistance, ';
55
-		ErrorMessage := ErrorMessage+#13#10+'please feel free to contact us.';
56
-	end;
57
-	
58
-	TaskDialog(0, 'DMDirc Setup', context, ErrorMessage, TD_ICON_ERROR, TD_BUTTON_OK, true);
59
-end;
60
-
61
-procedure showmessage(message: String; context:String = 'Information');
62
-begin
63
-	TaskDialog(0, 'DMDirc Uninstaller', context, message, TD_ICON_INFORMATION, TD_BUTTON_OK);
64
-end;
65
-
63
+{ ----------------------------------------------------------------------------
64
+  Create a temp directory and return the path to it
65
+  ---------------------------------------------------------------------------- }
66 66
 function GetTempDirectory(): String;
67 67
 var
68 68
 	buf: array[0..MAX_PATH] of Char;
@@ -79,37 +79,9 @@ begin
79 79
 	result := wintemp+temp+'\';
80 80
 end;
81 81
 
82
-
83
-// Run an application and don't wait for it to finish.
84
-function Launch(sProgramToRun: String; hide: boolean = false): TProcessInformation;
85
-var
86
-	StartupInfo: TStartupInfo;
87
-begin
88
-	FillChar(StartupInfo, SizeOf(TStartupInfo), 0);
89
-	with StartupInfo do begin
90
-		cb := SizeOf(TStartupInfo);
91
-		dwFlags := STARTF_USESHOWWINDOW;
92
-		if hide then wShowWindow := SW_HIDE
93
-		else wShowWindow := SW_SHOWNORMAL;
94
-	end;
95
-
96
-	CreateProcess(nil, PChar(sProgramToRun), nil, nil, False, NORMAL_PRIORITY_CLASS, nil, nil, StartupInfo, Result);
97
-end;
98
-
99
-// Run an application and wait for it to finish.
100
-function ExecAndWait(sProgramToRun: String; hide: boolean = false): Longword;
101
-var
102
-	ProcessInfo: TProcessInformation;
103
-begin
104
-	ProcessInfo := Launch(sProgramToRun, hide);
105
-	getExitCodeProcess(ProcessInfo.hProcess, Result);
106
-
107
-	while Result=STILL_ACTIVE do begin
108
-		sleep(1000);
109
-		GetExitCodeProcess(ProcessInfo.hProcess, Result);
110
-	end;
111
-end;
112
-
82
+{ ----------------------------------------------------------------------------
83
+  Delete a directory and all files it contains
84
+  ---------------------------------------------------------------------------- }
113 85
 function KillDir(Dir: string): Integer;
114 86
 var
115 87
 	searchResult: TSearchRec;
@@ -139,6 +111,9 @@ begin
139 111
 	end;
140 112
 end;
141 113
 
114
+{ ----------------------------------------------------------------------------
115
+  MAIN PROGRAM
116
+  ---------------------------------------------------------------------------- }
142 117
 var
143 118
 	TempDir: String;
144 119
 	InstallDir: String = '';
@@ -203,21 +178,22 @@ begin
203 178
 		Reg.Free;
204 179
 		
205 180
 		if (FileExists(profileDir+'\dmdirc.config')) then begin
206
-			if MessageBox(0, PChar('A dmdirc profile has been detected ('+profileDir+') '+#13#10+'Do you want to delete it aswell?'), 'DMDirc Uninstaller', MB_YESNO) = 
207
-IDYES then begin
181
+			if MessageBox(0, PChar('A dmdirc profile has been detected ('+profileDir+') '+#13#10+'Do you want to delete it aswell?'), 'DMDirc Uninstaller', MB_YESNO) = IDYES then begin
208 182
 				KillDir(profileDir);
209 183
 			end;
210 184
 		end;
211 185
 		
212
-		showmessage('DMDirc has been uninstalled from "'+InstallDir+'".', 'Uninstall Successful');
186
+		showmessage('DMDirc has been uninstalled from "'+InstallDir+'".', 'DMDirc Uninstaller', 'Uninstall Successful');
213 187
 	end
214
-	else if askQuestion('This will uninstall DMDirc. '+#13#10+#13#10+'Do you want to continue?') then begin
188
+	else if askQuestion('This will uninstall DMDirc. '+#13#10+#13#10+'Do you want to continue?', 'DMDirc Uninstaller') then begin
215 189
 		if (ExecAndWait('java -jar "' + ExtractFileDir(paramstr(0)) + '\DMDirc.jar" -k', true) <> 0) then begin
216 190
 			TempDir := GetTempDirectory;
217 191
 			CopyFile(pchar(paramstr(0)), pchar(TempDir+'/uninstall.exe'), false);
218 192
 			Launch('"'+TempDir+'/uninstall.exe" '+ExtractFileDir(paramstr(0))+'\');
219 193
 		end else begin
220
-			showError('Uninstall Aborted - DMDirc is still running.', 'Please close DMDirc before continuing')
194
+			showError('Uninstall Aborted - DMDirc is still running.' +
195
+                #13#10 + 'Please close DMDirc before continuing',
196
+                'DMDirc Uninstaller', False, False);
221 197
 		end;
222 198
 	end;
223 199
 end.

+ 0
- 52
launcher/windows/DMDirc.dpr View File

@@ -36,58 +36,6 @@ uses Vista, shared, Windows, SysUtils, classes, StrUtils;
36 36
 procedure InitCommonControls; stdcall; External 'comctl32.dll' name 'InitCommonControls';
37 37
 { ---------------------------------------------------------------------------- }
38 38
 
39
-{ ----------------------------------------------------------------------------
40
-  Launch a process (hidden if requested) and wait for it to finish
41
-  ---------------------------------------------------------------------------- }
42
-function ExecAndWait(sProgramToRun: String): Longword;
43
-var
44
-  StartupInfo: TStartupInfo;
45
-  ProcessInfo: TProcessInformation;
46
-begin
47
-  FillChar(StartupInfo, SizeOf(TStartupInfo), 0);
48
-  with StartupInfo do begin
49
-    cb := SizeOf(TStartupInfo);
50
-    dwFlags := STARTF_USESHOWWINDOW;
51
-    wShowWindow := SW_SHOWNORMAL;
52
-  end;
53
-
54
-  CreateProcess(nil, PChar(sProgramToRun), nil, nil, False, NORMAL_PRIORITY_CLASS, nil, nil, StartupInfo, ProcessInfo);
55
-  getExitCodeProcess(ProcessInfo.hProcess, Result);
56
-
57
-  while Result=STILL_ACTIVE do begin
58
-    sleep(1000);
59
-    GetExitCodeProcess(ProcessInfo.hProcess, Result);
60
-  end;
61
-end;
62
-
63
-{ ----------------------------------------------------------------------------
64
-  Launch a process (hidden if requested) and immediately return control to
65
-  the current thread
66
-  ---------------------------------------------------------------------------- }
67
-procedure Launch(sProgramToRun: String);
68
-var
69
-  StartupInfo: TStartupInfo;
70
-  ProcessInfo: TProcessInformation;
71
-begin
72
-  FillChar(StartupInfo, SizeOf(TStartupInfo), 0);
73
-  with StartupInfo do begin
74
-    cb := SizeOf(TStartupInfo);
75
-    dwFlags := STARTF_USESHOWWINDOW;
76
-    wShowWindow := SW_SHOWNORMAL;
77
-  end;
78
-
79
-  CreateProcess(nil, PChar(sProgramToRun), nil, nil, False, NORMAL_PRIORITY_CLASS, nil, nil, StartupInfo, ProcessInfo);
80
-end;
81
-
82
-{ ----------------------------------------------------------------------------
83
-  Launch a process and either waits for it or returns control immediately
84
-  ---------------------------------------------------------------------------- }
85
-procedure RunProgram(sProgramToRun: String; wait: boolean);
86
-begin
87
-  if wait then ExecAndWait(sProgramToRun)
88
-  else Launch(sProgramToRun);
89
-end;
90
-
91 39
 { ----------------------------------------------------------------------------
92 40
   MAIN PROGRAM
93 41
   ---------------------------------------------------------------------------- }

+ 116
- 123
launcher/windows/DMDircUpdater.dpr View File

@@ -1,136 +1,129 @@
1
+{*
2
+ * Updates DMDirc windows components
3
+ *
4
+ * DMDirc - Open Source IRC Client
5
+ * Copyright (c) 2006-2009 Chris Smith, Shane Mc Cormack, Gregory Holmes,
6
+ * Michael Nixon
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the "Software"), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in
16
+ * all copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ * SOFTWARE.
25
+ *}
1 26
 program DMDircUpdater;
2 27
 {$MODE Delphi}
3 28
 {$APPTYPE GUI}
4 29
 
5 30
 {$R UAC.rc}
6 31
 
7
-uses Windows, SysUtils, classes, StrUtils, Vista;
32
+uses Vista, shared, Windows, SysUtils, classes, StrUtils;
33
+procedure InitCommonControls; stdcall; External 'comctl32.dll' name 'InitCommonControls';
34
+{ ---------------------------------------------------------------------------- }
8 35
 
9
-function askQuestion(Question: String): boolean;
10
-begin
11
-	Result := TaskDialog(0, 'DMDirc Updater', 'Question', Question, TD_ICON_QUESTION, TD_BUTTON_YES + TD_BUTTON_NO) = mrYes;
12
-end;
13
-
14
-procedure showError(ErrorMessage: String; addFooter: boolean = true);
36
+{ ----------------------------------------------------------------------------
37
+  MAIN PROGRAM
38
+  ---------------------------------------------------------------------------- }
39
+var
40
+  sourceDir: String = '';
41
+  thisDir: String;
42
+  cliParams: String = '';
43
+  i: integer;
44
+  jarName: String;
45
+  launcherUpdate: boolean = false;
46
+  myName: String;
47
+  canDoMore: boolean = true;
15 48
 begin
16
-	if addFooter then begin
17
-		ErrorMessage := ErrorMessage+#13#10;
18
-		ErrorMessage := ErrorMessage+#13#10+'If you feel this is incorrect, or you require some further assistance,';
19
-		ErrorMessage := ErrorMessage+#13#10+'please feel free to contact us.';
20
-	end;
21
-	
22
-	TaskDialog(0, 'DMDirc Updater', 'There was an error starting DMDirc', ErrorMessage, TD_ICON_ERROR, TD_BUTTON_OK, false, false);
23
-end;
49
+  myName := ExtractFileName(paramstr(0));
50
+  thisDir := ExtractFileDir(paramstr(0));
51
+  jarName := thisDir+'\DMDirc.jar';
24 52
 
25
-procedure showmessage(message: String; context:String = 'Information');
26
-begin
27
-	TaskDialog(0, 'DMDirc Updater', context, message, TD_ICON_INFORMATION, TD_BUTTON_OK);
28
-end;
53
+  if ParamCount > 0 then begin
54
+    for i := 1 to ParamCount do begin
55
+      if AnsiContainsStr(cliParams, ' ') then cliParams := cliParams+' "'+paramstr(i)+'"'
56
+      else cliParams := cliParams+' '+paramstr(i);
57
+      if (paramstr(i) = '--UpdateSourceDir') then begin // Source Directory
58
+        if ParamCount > i then begin
59
+          sourceDir := paramstr(i+1);
60
+        end;
61
+      end
62
+    end;
29 63
 
30
-// Run an application and don't wait for it to finish.
31
-procedure Launch(sProgramToRun: String);
32
-var
33
-	StartupInfo: TStartupInfo;
34
-	ProcessInfo: TProcessInformation;
35
-begin
36
-	FillChar(StartupInfo, SizeOf(TStartupInfo), 0);
37
-	with StartupInfo do begin
38
-		cb := SizeOf(TStartupInfo);
39
-		dwFlags := STARTF_USESHOWWINDOW;
40
-		wShowWindow := SW_SHOWNORMAL;
41
-	end;
42
-	// MessageBox(0, pchar('Foo: '+sProgramToRun), 'Update Failed', MB_ICONSTOP);
43
-	CreateProcess(nil, PChar(sProgramToRun), nil, nil, False, NORMAL_PRIORITY_CLASS, nil, nil, StartupInfo, ProcessInfo);
44
-end;
64
+    // Look for a launcher update.
65
+    if FileExists(pchar(sourceDir+'\.DMDirc.exe')) and FileExists(pchar(sourceDir+'\.DMDircUpdater.exe')) then begin
66
+      if myName = 'DMDircUpdater.exe' then begin
67
+        // Windows won't let us overwrite ourself, so we need to copy ourself
68
+        // to another name, and run the new us.
69
+        if CopyFile(pchar(thisDir+'\DMDircUpdater.exe'), pchar(thisDir+'\DMDircLauncherUpdater.exe'), False) then begin
70
+          canDoMore := false;
71
+          Launch('"'+thisDir+'\DMDircLauncherUpdater.exe" '+cliParams);
72
+        end
73
+        else begin
74
+          showmessage('Unable to overwrite launcher', 'DMDirc', 'Update Failed');
75
+        end;
76
+      end
77
+      else begin
78
+        launcherUpdate := true;
79
+        if FileExists(pchar(thisDir+'\DMDirc.exe')) then begin
80
+          if not DeleteFile(pchar(thisDir+'\DMDirc.exe')) then begin
81
+            showmessage('Unable to delete DMDirc.exe', 'DMDirc', 'Launcher Update Failed');
82
+          end;
83
+        end;
84
+        
85
+        if not FileExists(pchar(thisDir+'\DMDirc.exe')) and MoveFile(pchar(sourceDir+'\.DMDirc.exe'), pchar(thisDir+'\DMDirc.exe')) then begin
86
+          if FileExists(pchar(thisDir+'\DMDircUpdater.exe')) then begin
87
+            if not DeleteFile(pchar(thisDir+'\DMDircUpdater.exe')) then begin
88
+              showmessage('Unable to delete DMDircUpdater.exe', 'DMDirc', 'Launcher Update Failed');
89
+            end;
90
+          end;
91
+          if not FileExists(pchar(thisDir+'\DMDircUpdater.exe')) and MoveFile(pchar(sourceDir+'\.DMDircUpdater.exe'), pchar(thisDir+'\DMDircUpdater.exe')) then begin
92
+            showmessage('Launcher update was successful', 'DMDirc');
93
+          end
94
+          else begin
95
+            showmessage('Unable to update DMDircUpdater.exe', 'DMDirc', 'Launcher Update Failed');
96
+          end;
97
+        end
98
+        else begin
99
+          showmessage('Unable to update DMDirc.exe', 'DMDirc', 'Launcher Update Failed');
100
+        end;
101
+      end;
102
+    end;
45 103
 
46
-var
47
-	sourceDir: String = '';
48
-	thisDir: String;
49
-	cliParams: String = '';
50
-	i: integer;
51
-	jarName: String;
52
-	launcherUpdate: boolean = false;
53
-	myName: String;
54
-	canDoMore: boolean = true;
55
-begin
56
-	myName := ExtractFileName(paramstr(0));
57
-	thisDir := ExtractFileDir(paramstr(0));
58
-	jarName := thisDir+'\DMDirc.jar';
59
-	
60
-	if ParamCount > 0 then begin
61
-		for i := 1 to ParamCount do begin
62
-			if AnsiContainsStr(cliParams, ' ') then cliParams := cliParams+' "'+paramstr(i)+'"'
63
-			else cliParams := cliParams+' '+paramstr(i);
64
-			if (paramstr(i) = '--UpdateSourceDir') then begin // Source Directory
65
-				if ParamCount > i then begin
66
-					sourceDir := paramstr(i+1);
67
-				end;
68
-			end
69
-		end;
104
+    // Look for client update
105
+    if canDoMore then begin
106
+      if FileExists(pchar(sourceDir+'\.DMDirc.jar')) then begin
107
+        if FileExists(pchar(jarName)) then begin
108
+          if not DeleteFile(pchar(jarName)) then begin
109
+            showmessage('Unable to update DMDirc.jar', 'DMDirc', 'Launcher Update Failed');
110
+          end;
111
+        end;
70 112
 
71
-		// Look for a launcher update.
72
-		if FileExists(pchar(sourceDir+'\.DMDirc.exe')) and FileExists(pchar(sourceDir+'\.DMDircUpdater.exe')) then begin
73
-			if myName = 'DMDircUpdater.exe' then begin
74
-				// Windows won't let us overwrite ourself, so we need to copy ourself
75
-				// to another name, and run the new us.
76
-				if CopyFile(pchar(thisDir+'\DMDircUpdater.exe'), pchar(thisDir+'\DMDircLauncherUpdater.exe'), False) then begin
77
-					canDoMore := false;
78
-					Launch('"'+thisDir+'\DMDircLauncherUpdater.exe" '+cliParams);
79
-				end
80
-				else begin
81
-					showmessage('Unable to overwrite launcher', 'Update Failed');
82
-				end;
83
-			end
84
-			else begin
85
-				launcherUpdate := true;
86
-				if FileExists(pchar(thisDir+'\DMDirc.exe')) then begin
87
-					if not DeleteFile(pchar(thisDir+'\DMDirc.exe')) then begin
88
-						showmessage('Unable to delete DMDirc.exe', 'Launcher Update Failed');
89
-					end;
90
-				end;
91
-				
92
-				if not FileExists(pchar(thisDir+'\DMDirc.exe')) and MoveFile(pchar(sourceDir+'\.DMDirc.exe'), pchar(thisDir+'\DMDirc.exe')) then begin
93
-					if FileExists(pchar(thisDir+'\DMDircUpdater.exe')) then begin
94
-						if not DeleteFile(pchar(thisDir+'\DMDircUpdater.exe')) then begin
95
-							showmessage('Unable to delete DMDircUpdater.exe', 'Launcher Update Failed');
96
-						end;
97
-					end;
98
-					if not FileExists(pchar(thisDir+'\DMDircUpdater.exe')) and MoveFile(pchar(sourceDir+'\.DMDircUpdater.exe'), pchar(thisDir+'\DMDircUpdater.exe')) then begin
99
-						showmessage('Launcher update was successful');
100
-					end
101
-					else begin
102
-						showmessage('Unable to update DMDircUpdater.exe', 'Launcher Update Failed');
103
-					end;
104
-				end
105
-				else begin
106
-					showmessage('Unable to update DMDirc.exe', 'Launcher Update Failed');
107
-				end;
108
-			end;
109
-		end;
110
-		
111
-		// Look for client update
112
-		if canDoMore then begin
113
-			if FileExists(pchar(sourceDir+'\.DMDirc.jar')) then begin
114
-				if FileExists(pchar(jarName)) then begin
115
-					if not DeleteFile(pchar(jarName)) then begin
116
-						showmessage('Unable to update DMDirc.jar', 'Launcher Update Failed');
117
-					end;
118
-				end;
119
-				
120
-				if MoveFile(pchar(sourceDir+'\.DMDirc.jar'), pchar(jarName)) then begin
121
-					showmessage('Client update was successful');
122
-				end
123
-				else begin
124
-					showmessage('Unable to move '''+sourceDir+'\.DMDirc.jar'' to '+jarName, 'Update Failed');
125
-				end;
126
-			end;
127
-			
128
-			if launcherUpdate then begin
129
-				showmessage('The DMDirc launcher has been updated, to complete the update please relaunch DMDirc.', 'Restart Required');
130
-			end;
131
-		end;
132
-	end
133
-	else begin
134
-		showError('This program can not be run on its own.');
135
-	end;
113
+        if MoveFile(pchar(sourceDir+'\.DMDirc.jar'), pchar(jarName)) then begin
114
+          showmessage('Client update was successful', 'DMDirc');
115
+        end
116
+        else begin
117
+          showmessage('Unable to move '''+sourceDir+'\.DMDirc.jar'' to '+jarName, 'DMDirc', 'Update Failed');
118
+        end;
119
+      end;
120
+      
121
+      if launcherUpdate then begin
122
+        showmessage('The DMDirc launcher has been updated, to complete the update please relaunch DMDirc.', 'DMDirc', 'Restart Required');
123
+      end;
124
+    end;
125
+  end
126
+  else begin
127
+    showError('This program can not be run on its own.', 'DMDirc');
128
+  end;
136 129
 end.

Loading…
Cancel
Save