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:
parent
6ad374006f
commit
f1b420849d
1 changed files with 23 additions and 0 deletions
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue