From aa1b48ef1c7e42ce3a4c3cb3e9e8e79e03f7da5b Mon Sep 17 00:00:00 2001 From: Daniel Westheide Date: Tue, 15 May 2018 13:50:43 +0200 Subject: [PATCH] Remove use of deprecated *ModifiedTime methods Replaces call to setModifiedTime with setModifiedTimeOrFalse and getModifiedTime with Milli.getModifiedTime. --- io/src/main/scala/sbt/io/IO.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/io/src/main/scala/sbt/io/IO.scala b/io/src/main/scala/sbt/io/IO.scala index a8c5cc96..15429e15 100644 --- a/io/src/main/scala/sbt/io/IO.scala +++ b/io/src/main/scala/sbt/io/IO.scala @@ -205,8 +205,8 @@ object IO { val created = translate("Could not create file " + absFile) { absFile.createNewFile() } if (created || absFile.isDirectory) () - else if (setModified) - setModifiedTime(absFile, System.currentTimeMillis) // will throw exception if it cannot set the timestamp + else if (setModified && !setModifiedTimeOrFalse(absFile, System.currentTimeMillis)) + sys.error("Could not update last modified time for file " + absFile) } /** Creates directories `dirs` and all parent directories. It tries to work around a race condition in `File.mkdirs()` by retrying up to a limit.*/ @@ -1209,7 +1209,7 @@ object IO { */ def getModifiedTimeOrZero(file: File): Long = try { - getModifiedTime(file) + Milli.getModifiedTime(file) } catch { case _: FileNotFoundException => 0L }