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

Fix #211: Append System.lineSeparator() to last line #212

Merged
merged 1 commit into from
Oct 1, 2024
Merged

Conversation

melloware
Copy link
Member

Fix #211: Append System.lineSeparator() to last line

@melloware melloware added the bug label Oct 1, 2024
@melloware melloware requested a review from blutorange October 1, 2024 13:33
}

// write / append content into / to the new file
Files.asCharSink(outputFile, cset, FileWriteMode.APPEND).write(writer.toString());
Files.asCharSink(outputFile, cset, FileWriteMode.APPEND).write(System.lineSeparator() + writer.toString());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks all good to me 👍 Technically I suppose this adds two line terminators to JS files (?), but there's no problem with that. Regarding the type of line separator, both CSS and EcmaScript support both \n\r and \n, so that should also be ok.

A micro-optimization (probably not needed): Call write twice instead of concatenating System.lineSeparator() with writer.toString().

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea just refactored to make it cleaner

@melloware melloware merged commit 6cffca4 into master Oct 1, 2024
6 checks passed
@melloware melloware deleted the 211 branch October 1, 2024 14:03
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 this pull request may close these issues.

Aggregation does not behave correctly when input files end with a comment
2 participants