Skip to content

TLogFileProvider fails to append to existing log file on iOS #127

Description

@DelphiWorlds

As per the title, the log file is not appended to if it already exists, due to this code:

  if TFile.Exists(fFileName) then
  begin
    fFileCreationDate := TFile.GetCreationTime(fFileName);
    FileMode := fmOpenWrite or fmShareDenyWrite;
  end

The fmShareDenyWrite flag causes this line:

  fs := TFileStream.Create(fFileName, FileMode);

To fail with an invalid file descriptor error. One possible fix:

  if TFile.Exists(fFileName) then
  begin
    fFileCreationDate := TFile.GetCreationTime(fFileName);
    FileMode := fmOpenWrite;
    {$IF not Defined(IOS)}
    FileMode := FileMode or fmShareDenyWrite;
    {$ENDIF}
  end

Although I would first test on platforms other than iOS and Windows

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions