io.gitlab.arturbosch.detekt.internal.FileMangling.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of detekt-gradle-plugin Show documentation
Show all versions of detekt-gradle-plugin Show documentation
Static code analysis for Kotlin
package io.gitlab.arturbosch.detekt.internal
import java.io.File
internal fun File?.existingVariantOrBaseFile(variant: String): File? {
val variantFile = this?.addVariantName(variant)
// if there is a file with the variant name, it has precedence
return when {
variantFile?.exists() == true -> variantFile
this?.exists() == true -> this
else -> null
}
}
internal fun File.addVariantName(variant: String, separator: String = "-"): File =
File(parent, name.substringBeforeLast(".") + "$separator$variant." + name.substringAfterLast("."))
© 2015 - 2025 Weber Informatics LLC | Privacy Policy