hedgewars/uUtils.pas
changeset 10127 7f29a65aa1e4
parent 10124 aabd1b75d5a3
child 10131 4b4a043111f4
equal deleted inserted replaced
10126:2fa3bb7785ee 10127:7f29a65aa1e4
   514 {$ENDIF}
   514 {$ENDIF}
   515 {$I-}
   515 {$I-}
   516 {$IFNDEF PAS2C}
   516 {$IFNDEF PAS2C}
   517     f:= stderr; // if everything fails, write to stderr
   517     f:= stderr; // if everything fails, write to stderr
   518 {$ENDIF}
   518 {$ENDIF}
   519     if (UserPathPrefix <> '') then
   519     if (length(UserPathPrefix) > 0) then
   520         begin
   520         begin
   521         {$IFNDEF PAS2C}
   521         {$IFNDEF PAS2C}
   522         // create directory if it doesn't exist
   522         // create directory if it doesn't exist
   523         if not FileExists(UserPathPrefix + '/Logs/') then
   523         if not FileExists(UserPathPrefix + '/Logs/') then
   524             CreateDir(UserPathPrefix + '/Logs/');
   524             CreateDir(UserPathPrefix + '/Logs/');
   525         {$ENDIF}
   525         {$ENDIF}
   526         // if log is locked, write to the next one
   526         // if log is locked, write to the next one
   527         i:= 0;
   527         i:= 0;
   528         while(i < 7) do
   528         while(i < 7) do
   529             begin
   529             begin
   530             assign(f, UserPathPrefix + '/Logs/' + logfileBase + inttostr(i) + '.log');
   530             assign(f, shortstring(UserPathPrefix) + '/Logs/' + logfileBase + inttostr(i) + '.log');
   531             if IOResult = 0 then
   531             if IOResult = 0 then
   532                 break;
   532                 break;
   533             inc(i)
   533             inc(i)
   534             end;
   534             end;
   535         end;
   535         end;