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

added manager for .kobalt/versionCheckTimestamp.txt

This commit is contained in:
voddan 2016-01-29 21:23:04 +03:00
parent 6ad374006f
commit f1b420849d

View file

@ -0,0 +1,23 @@
package com.beust.kobalt.internal.build
import com.beust.kobalt.misc.KFiles
import java.io.File
import java.time.Instant
class VersionCheckTimestampFile {
companion object {
private val KOBALT_VERSION_CHECK_TIMESTAMP_FILE = "versionCheckTimestamp.txt"
private val checkTimestampFile = File(KFiles.KOBALT_DOT_DIR, KOBALT_VERSION_CHECK_TIMESTAMP_FILE)
fun updateTimestamp(timestamp: Instant) = KFiles.saveFile(checkTimestampFile, timestamp.toString())
fun getTimestamp(): Instant {
return if(checkTimestampFile.exists())
Instant.parse(checkTimestampFile.readText())
else {
updateTimestamp(Instant.MIN)
Instant.MIN
}
}
}
}