Skip to content

Commit

Permalink
Fix inserting incorrect line breaks in temp files
Browse files Browse the repository at this point in the history
  • Loading branch information
Roggstars committed Nov 30, 2024
1 parent add2ad4 commit 33d6c93
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.intellij.lang.annotations.Language
fun File.appendToBuildGradle(content: String) {
resolve("build.gradle.kts").apply {
appendText(System.lineSeparator())
appendText(content)
appendText(content.ensureLineSeparator())
appendText(System.lineSeparator())
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.ncorti.ktfmt.gradle.testutil

fun String.ensureLineSeparator(): String = replace(Regex("\r|\n|\r\n}"), System.lineSeparator())

0 comments on commit 33d6c93

Please sign in to comment.