# HG changeset patch
# User sheepluva
# Date 1461754898 -7200
# Node ID eefa04b23c3b45bb8938e45ca91d552f154c4678
# Parent  35d1654b3c9ad5e7abbf7b38537efa0d8ae7b3f8
fallback to stdout if no writable logfile available

diff -r 35d1654b3c9a -r eefa04b23c3b hedgewars/uUtils.pas
--- a/hedgewars/uUtils.pas	Wed Apr 27 11:41:32 2016 +0200
+++ b/hedgewars/uUtils.pas	Wed Apr 27 13:01:38 2016 +0200
@@ -352,7 +352,10 @@
 {$IFDEF USE_VIDEO_RECORDING}
 EnterCriticalSection(logMutex);
 {$ENDIF}
-pfsWriteLn(logFile, inttostr(GameTicks)  + ': ' + s);
+if logFile <> nil then
+    pfsWriteLn(logFile, inttostr(GameTicks)  + ': ' + s)
+else
+    WriteLn(stdout, inttostr(GameTicks)  + ': ' + s);
 
 {$IFDEF USE_VIDEO_RECORDING}
 LeaveCriticalSection(logMutex);
@@ -544,6 +547,9 @@
             break;
         inc(i)
     end;
+
+    if logFile = nil then
+        WriteLn(stdout, '[WARNING] Could not open log file for writing. Log will be written to stdout!');
 {$ENDIF}
 
     //mobile stuff