hedgewars/uMisc.pas
changeset 3534 51521238724f
parent 3533 03892fb97ab3
child 3537 8f5b3108f29c
--- a/hedgewars/uMisc.pas	Tue Jun 22 17:10:27 2010 +0200
+++ b/hedgewars/uMisc.pas	Tue Jun 22 18:06:55 2010 +0200
@@ -776,14 +776,25 @@
     Rewrite(f);
 {$ELSE}
     if (ParamStr(1) <> '') and (ParamStr(2) <> '') then
-        begin
-        for i:= 0 to 7 do
+        if (ParamCount <> 3) and (ParamCount <> 18) then
         begin
-            assign(f, ExtractFileDir(ParamStr(2)) + '/debug' + inttostr(i) + '.txt');
-            rewrite(f);
-            if IOResult = 0 then break;
-        end;
-        if IOResult <> 0 then f:= stderr; // if everything fails, write to stderr
+            for i:= 0 to 7 do
+            begin
+                assign(f, ExtractFileDir(ParamStr(2)) + '/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
+        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;