ok really fix the command line utility
authorkoda
Tue, 22 Jun 2010 18:06:55 +0200
changeset 3534 51521238724f
parent 3533 03892fb97ab3
child 3535 9e78c1f3d8d8
child 3536 7d99655130ff
ok really fix the command line utility
hedgewars/uMisc.pas
--- 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;