1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 00:17:11 -07:00

Was recompiling the build file every time.

This commit is contained in:
Cedric Beust 2015-12-18 22:51:48 +04:00
parent 87d1f81d14
commit 9a5fcd1e38
3 changed files with 6 additions and 5 deletions

View file

@ -6,12 +6,13 @@ import java.nio.file.Path
import java.nio.file.attribute.BasicFileAttributes
/**
* Sometimes, build files are moved to temporary files, so we give them a specific name for clarity.
* @param path is the path where that file was moved, @param realPath is where the actual file is.
*/
class BuildFile(val path: Path, val name: String) {
class BuildFile(val path: Path, val name: String, val realPath: Path = path) {
public fun exists() : Boolean = Files.exists(path)
public val lastModified : Long
get() = Files.readAttributes(path, BasicFileAttributes::class.java).lastModifiedTime().toMillis()
get() = Files.readAttributes(realPath, BasicFileAttributes::class.java).lastModifiedTime().toMillis()
public val directory : File get() = path.toFile().directory
}