equal
deleted
inserted
replaced
512 |
512 |
513 procedure initModule(isNotPreview: boolean); |
513 procedure initModule(isNotPreview: boolean); |
514 {$IFDEF DEBUGFILE} |
514 {$IFDEF DEBUGFILE} |
515 var logfileBase: shortstring; |
515 var logfileBase: shortstring; |
516 i: LongInt; |
516 i: LongInt; |
|
517 rwfailed: boolean; |
517 {$ENDIF} |
518 {$ENDIF} |
518 begin |
519 begin |
519 {$IFDEF DEBUGFILE} |
520 {$IFDEF DEBUGFILE} |
520 if isNotPreview then |
521 if isNotPreview then |
521 begin |
522 begin |
536 {$ENDIF} |
537 {$ENDIF} |
537 {$IFDEF USE_VIDEO_RECORDING} |
538 {$IFDEF USE_VIDEO_RECORDING} |
538 InitCriticalSection(logMutex); |
539 InitCriticalSection(logMutex); |
539 {$ENDIF} |
540 {$ENDIF} |
540 {$I-} |
541 {$I-} |
|
542 rwfailed:= false; |
541 if (length(UserPathPrefix) > 0) then |
543 if (length(UserPathPrefix) > 0) then |
542 begin |
544 begin |
543 {$IFNDEF PAS2C} |
545 {$IFNDEF PAS2C} |
544 // create directory if it doesn't exist |
546 // create directory if it doesn't exist |
545 if not FileExists(UserPathPrefix + '/Logs/') then |
547 if not FileExists(UserPathPrefix + '/Logs/') then |
549 i:= 0; |
551 i:= 0; |
550 while(i < 7) do |
552 while(i < 7) do |
551 begin |
553 begin |
552 assign(logFile, shortstring(UserPathPrefix) + '/Logs/' + logfileBase + inttostr(i) + '.log'); |
554 assign(logFile, shortstring(UserPathPrefix) + '/Logs/' + logfileBase + inttostr(i) + '.log'); |
553 Rewrite(logFile); |
555 Rewrite(logFile); |
554 if IOResult = 0 then |
556 rwfailed:= (IOResult() <> 0); |
|
557 if (not rwfailed) then |
555 break; |
558 break; |
556 inc(i) |
559 inc(i) |
557 end; |
560 end; |
558 end; |
561 end; |
559 |
562 |
560 {$IFNDEF PAS2C} |
563 {$IFNDEF PAS2C} |
561 // if everything fails, write to stderr |
564 // if everything fails, write to stderr |
562 if (length(UserPathPrefix) = 0) or (IOResult <> 0) then |
565 if (length(UserPathPrefix) = 0) or (rwfailed) then |
563 logFile:= stderr; |
566 logFile:= stderr; |
564 {$ENDIF} |
567 {$ENDIF} |
565 {$I+} |
568 {$I+} |
566 {$ENDIF} |
569 {$ENDIF} |
567 |
570 |