hedgewars/uMisc.pas
changeset 3533 03892fb97ab3
parent 3513 f589230fa21b
child 3534 51521238724f
--- a/hedgewars/uMisc.pas	Mon Jun 21 22:45:52 2010 +0200
+++ b/hedgewars/uMisc.pas	Tue Jun 22 17:10:27 2010 +0200
@@ -170,7 +170,7 @@
 {$ENDIF}
 
 implementation
-uses Math, uConsole, uStore, uIO, uSound, typinfo;
+uses Math, uConsole, uStore, uIO, uSound, typinfo, sysutils;
 
 var KBnum: Longword;
 {$IFDEF DEBUGFILE}
@@ -775,11 +775,11 @@
     Assign(f,'../Documents/debug.txt');
     Rewrite(f);
 {$ELSE}
-    if ParamStr(1) <> '' then
+    if (ParamStr(1) <> '') and (ParamStr(2) <> '') then
         begin
         for i:= 0 to 7 do
         begin
-            assign(f, ParamStr(1) + '/debug' + inttostr(i) + '.txt');
+            assign(f, ExtractFileDir(ParamStr(2)) + '/debug' + inttostr(i) + '.txt');
             rewrite(f);
             if IOResult = 0 then break;
         end;