hedgewars/uUtils.pas
changeset 10573 3b82b4d90eb7
parent 10572 c4e86a2efc55
child 10574 1636b0efa415
--- a/hedgewars/uUtils.pas	Sat Nov 29 15:25:09 2014 +0100
+++ b/hedgewars/uUtils.pas	Sat Nov 29 15:38:28 2014 +0100
@@ -538,9 +538,6 @@
     InitCriticalSection(logMutex);
 {$ENDIF}
 {$I-}
-{$IFNDEF PAS2C}
-    logFile:= stderr; // if everything fails, write to stderr
-{$ENDIF}
     if (length(UserPathPrefix) > 0) then
         begin
         {$IFNDEF PAS2C}
@@ -553,12 +550,20 @@
         while(i < 7) do
             begin
             assign(logFile, shortstring(UserPathPrefix) + '/Logs/' + logfileBase + inttostr(i) + '.log');
+            Rewrite(logFile);
             if IOResult = 0 then
                 break;
             inc(i)
             end;
         end;
-    Rewrite(logFile);
+
+{$IFNDEF PAS2C}
+    if (length(UserPathPrefix) = 0) or (IOResult = 0) then
+        begin
+        logFile:= stderr; // if everything fails, write to stderr
+        Rewrite(logFile);
+        end;
+{$ENDIF}
 {$I+}
 {$ENDIF}