Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions src/main/Log4D.pas
Original file line number Diff line number Diff line change
Expand Up @@ -3042,7 +3042,6 @@ constructor TLogFileAppender.Create(const Name, FileName: string;
procedure TLogFileAppender.SetLogFile(const Name: string);
var
strPath: string;
f : TextFile;
begin
CloseLogFile;
FFileName := Name;
Expand All @@ -3057,20 +3056,14 @@ procedure TLogFileAppender.SetLogFile(const Name: string);
begin
// Check if directory exists
strPath := ExtractFileDir(FFileName);
if (strPath <> '') and not DirectoryExists(strPath) then
if (strPath <> '') and not DirectoryExists(strPath) then
ForceDirectories(strPath);

//FIX 04.10.2006 MHoenemann:
// SysUtils.FileCreate() ignores any sharing option (like our fmShareDenyWrite),
// Creating new file
AssignFile(f, FFileName);
try
ReWrite(f);
finally
CloseFile(f);
end;
// now use this file
FStream := TFileStream.Create(FFileName, fmOpenReadWrite or fmShareDenyNone);
// Creating new file directly via TFileStream with fmCreate, which truncates/creates
// the file and gives us the stream with the desired share mode in one step.
FStream := TFileStream.Create(FFileName, fmCreate or fmShareDenyNone);
end;
WriteHeader;
end;
Expand Down
Loading