Engine:
authorsmxx
Wed, 10 Feb 2010 17:53:21 +0000
changeset 2797 98b990feec7d
parent 2796 7f86e7ad378b
child 2798 d48bbe4518e6
Engine: * Redirect debug log to stderr in case no path was provided (e.g. run from command line)
hedgewars/uMisc.pas
--- a/hedgewars/uMisc.pas	Wed Feb 10 17:31:12 2010 +0000
+++ b/hedgewars/uMisc.pas	Wed Feb 10 17:53:21 2010 +0000
@@ -736,13 +736,18 @@
 {$IFDEF IPHONEOS}
 	f:= stderr;
 {$ELSE}
-	for i:= 0 to 7 do
-	begin
-		assign(f, ParamStr(1) + '/debug' + inttostr(i) + '.txt');
-		rewrite(f);
-		if IOResult = 0 then break;
-	end;
-	if IOResult <> 0 then f:= stderr; // if everything fails, write to stderr
+	if ParamStr(1) <> '' then
+		begin
+		for i:= 0 to 7 do
+		begin
+			assign(f, ParamStr(1) + '/debug' + inttostr(i) + '.txt');
+			rewrite(f);
+			if IOResult = 0 then break;
+		end;
+		if IOResult <> 0 then f:= stderr; // if everything fails, write to stderr
+		end
+	else
+		f:= stderr;
 {$ENDIF}
 {$I+}
 {$ENDIF}