Skip to content

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

@DelphiWorlds

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

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