Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ap0llo opened this issue Mar 13, 2023 · 1 comment · Fixed by #124
Closed

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

ap0llo opened this issue Mar 13, 2023 · 1 comment · Fixed by #124
Assignees
Labels
Milestone

Comments

@ap0llo
Copy link
Contributor

ap0llo commented Mar 13, 2023

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
@ap0llo ap0llo mentioned this issue Mar 13, 2023
9 tasks
@augustoproiete augustoproiete added this to the 6.1.3 milestone Mar 13, 2023
@augustoproiete augustoproiete linked a pull request Mar 13, 2023 that will close this issue
9 tasks
@cake-contrib-bot
Copy link

🎉 This issue has been resolved in version 6.1.3 🎉

The release is available on:

Your GitReleaseManager bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants