Merge pull request #1 from dwijnand/wip-milli

Use IO.getModified over importing the method
This commit is contained in:
cunei 2017-12-15 17:20:38 +01:00 committed by GitHub
commit d17245344d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 10 deletions

View File

@ -68,7 +68,8 @@ class FileCommands(baseDirectory: File) extends BasicStatementHandler {
def newer(a: String, b: String): Unit = {
val pathA = fromString(a)
val pathB = fromString(b)
val isNewer = pathA.exists && (!pathB.exists || getModifiedTime(pathA) > getModifiedTime(pathB))
val isNewer = pathA.exists &&
(!pathB.exists || IO.getModifiedTime(pathA) > IO.getModifiedTime(pathB))
if (!isNewer) {
scriptError(s"$pathA is not newer than $pathB")
}

View File

@ -6,10 +6,9 @@ package sbt.util
import java.io.File
import java.io.FileNotFoundException
import scala.util.control.NonFatal
import sbt.io.Hash
import sbt.io.{ Hash, IO }
import sjsonnew.{ Builder, JsonFormat, Unbuilder, deserializationError }
import CacheImplicits._
import sbt.io.IO.getModifiedTime
sealed trait FileInfo { def file: File }
sealed trait HashFileInfo extends FileInfo { def hash: List[Byte] }
@ -52,13 +51,10 @@ object FilesInfo {
object FileInfo {
def getModifiedTimeOrZero(file: File) = { // returns 0L if file does not exist
try {
getModifiedTime(file)
} catch {
case _: FileNotFoundException => 0L
}
}
// returns 0L if file does not exist
private def getModifiedTimeOrZero(file: File) =
try IO.getModifiedTime(file)
catch { case _: FileNotFoundException => 0L }
sealed trait Style {
type F <: FileInfo