Skip to content

Instantly share code, notes, and snippets.

@develar
Created August 18, 2017 20:05
Show Gist options
  • Save develar/db9ef805bbde3994ad33d010e8a40025 to your computer and use it in GitHub Desktop.
Save develar/db9ef805bbde3994ad33d010e8a40025 to your computer and use it in GitHub Desktop.
isDoNotWriteIfOnlyLineSeparatorChanged
if (processor is LazySchemeProcessor && processor.isDoNotWriteIfOnlyLineSeparatorChanged && file.exists()) {
val detectedLineSeparator = file.detectedLineSeparator
// scheme always uses LF
if (detectedLineSeparator != LineSeparator.LF.separatorString) {
val oldData = file.contentsToByteArray()
if (detectLineSeparators(Charsets.UTF_8.decode(ByteBuffer.wrap(oldData))) != LineSeparator.LF) {
}
}
}
// easy migration if not possible to implement getSchemeState fully correctly
open val isDoNotWriteIfOnlyLineSeparatorChanged: Boolean
get() = false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment