[util][no-java] added File.equals/.hashCode

This commit is contained in:
Vasily Levchenko
2018-07-05 18:55:44 +03:00
parent da7e31a10a
commit 856392a6e1
@@ -152,10 +152,17 @@ data class File constructor(internal val javaPath: Path) {
val javaHome
get() = File(System.getProperty("java.home"))
val pathSeparator = java.io.File.pathSeparator
}
fun readStrings() = mutableListOf<String>().also { list -> forEachLine{list.add(it)}}
override fun equals(other: Any?): Boolean {
val otherFile = other as? File ?: return false
return otherFile.javaPath.toAbsolutePath() == javaPath.toAbsolutePath()
}
override fun hashCode() = javaPath.toAbsolutePath().hashCode()
}
fun String.File(): File = File(this)