You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
552 B
Kotlin

package me.eater.hefbrug.dsl
import java.nio.file.Paths
sealed class Location {
data class File(override val path: String) : Location() {
override val directory: String
get() = java.io.File(path).parent.toString()
}
object Memory : Location() {
override val path: String = "-"
override val directory = System.getProperty("user.dir") ?: "-"
}
abstract val path: String
abstract val directory: String
fun resolve(file: String) = Paths.get(directory, file).toAbsolutePath().toString()
}