hedgewars/uUtils.pas
changeset 10573 3b82b4d90eb7
parent 10572 c4e86a2efc55
child 10574 1636b0efa415
equal deleted inserted replaced
10572:c4e86a2efc55 10573:3b82b4d90eb7
   536         {$ENDIF}
   536         {$ENDIF}
   537 {$IFDEF USE_VIDEO_RECORDING}
   537 {$IFDEF USE_VIDEO_RECORDING}
   538     InitCriticalSection(logMutex);
   538     InitCriticalSection(logMutex);
   539 {$ENDIF}
   539 {$ENDIF}
   540 {$I-}
   540 {$I-}
   541 {$IFNDEF PAS2C}
       
   542     logFile:= stderr; // if everything fails, write to stderr
       
   543 {$ENDIF}
       
   544     if (length(UserPathPrefix) > 0) then
   541     if (length(UserPathPrefix) > 0) then
   545         begin
   542         begin
   546         {$IFNDEF PAS2C}
   543         {$IFNDEF PAS2C}
   547         // create directory if it doesn't exist
   544         // create directory if it doesn't exist
   548         if not FileExists(UserPathPrefix + '/Logs/') then
   545         if not FileExists(UserPathPrefix + '/Logs/') then
   551         // if log is locked, write to the next one
   548         // if log is locked, write to the next one
   552         i:= 0;
   549         i:= 0;
   553         while(i < 7) do
   550         while(i < 7) do
   554             begin
   551             begin
   555             assign(logFile, shortstring(UserPathPrefix) + '/Logs/' + logfileBase + inttostr(i) + '.log');
   552             assign(logFile, shortstring(UserPathPrefix) + '/Logs/' + logfileBase + inttostr(i) + '.log');
       
   553             Rewrite(logFile);
   556             if IOResult = 0 then
   554             if IOResult = 0 then
   557                 break;
   555                 break;
   558             inc(i)
   556             inc(i)
   559             end;
   557             end;
   560         end;
   558         end;
   561     Rewrite(logFile);
   559 
       
   560 {$IFNDEF PAS2C}
       
   561     if (length(UserPathPrefix) = 0) or (IOResult = 0) then
       
   562         begin
       
   563         logFile:= stderr; // if everything fails, write to stderr
       
   564         Rewrite(logFile);
       
   565         end;
       
   566 {$ENDIF}
   562 {$I+}
   567 {$I+}
   563 {$ENDIF}
   568 {$ENDIF}
   564 
   569 
   565     //mobile stuff
   570     //mobile stuff
   566 {$IFDEF IPHONEOS}
   571 {$IFDEF IPHONEOS}