Skip to content

"Append" aliases (partially) overwrite the file instead of appending to it #123

@ap0llo

Description

@ap0llo

The "FileAppend*" aliases (FileAppendText and FileAppendLines), (partially) overwrite an existing file (writing starts at offset 0) instead of appending to it.

Expected Behavior

The content of an existing file is retained and additional text is appended to the end of the file

Current Behavior

The content of an existing file is (partially) overwritten.
When the content being appended is shorter than the existing content, the file's content is only partially replaced.

Possible Solution

When opening a file stream, use FileMode.Append instead of OpenOrCreate:

using var streamWriter = CreateStreamWriter(context, file, FileMode.OpenOrCreate);

Your Environment

  • Addin version used: 6.1.2
  • Cake Version used: 3.0.0
  • Operating System: Windows 10

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions