Skip to content

Commit

Permalink
Windows: Fix superfluous reggae re-runs due to newline diff
Browse files Browse the repository at this point in the history
The problem with multi-line string literals (used here as file contents,
e.g., for buildgen_main.d) is that they inherit the newline of the
source file. And on Windows, this is governed by git's autocrlf setting;
`\n` being converted to `\r\n` is the default setting AFAIK.
  • Loading branch information
kinke committed Jan 24, 2024
1 parent 8f85d9f commit 584aa3e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/reggae/reggae.d
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ private void writeIfDiffers(O)(auto ref O output, in string path, in string cont
import std.array: replace;
import std.path: dirName;

if(!path.exists || path.readText.replace("\r\n", "\n") != contents) {
if(!path.exists || path.readText.replace("\r\n", "\n") != contents.replace("\r\n", "\n")) {
output.log("Writing ", path);
if(!path.dirName.exists)
mkdirRecurse(path.dirName);
Expand Down

0 comments on commit 584aa3e

Please sign in to comment.