diff --git a/io/src/main/scala/sbt/internal/io/Milli.scala b/io/src/main/scala/sbt/internal/io/Milli.scala index 4d8f1dc4..fe2e4750 100644 --- a/io/src/main/scala/sbt/internal/io/Milli.scala +++ b/io/src/main/scala/sbt/internal/io/Milli.scala @@ -12,6 +12,7 @@ package sbt.internal.io import java.io.{ File, FileNotFoundException, IOException } import java.nio.{ ByteBuffer, ByteOrder } +import java.nio.file.Files import java.util.Date import com.sun.jna.platform.win32.Kernel32 @@ -396,7 +397,7 @@ object Milli { if (jdkTimestamps) None else { - val file = File.createTempFile("sbt.io.Milli", "test-file", projectDir) + val file = Files.createTempFile(projectDir.toPath(), "sbt.io.Milli", "test-file").toFile try { val originalTime = getModifiedTime(file) setModifiedTime(file, originalTime - 27) diff --git a/io/src/main/scala/sbt/io/IO.scala b/io/src/main/scala/sbt/io/IO.scala index 69b9d40b..edb8ca46 100644 --- a/io/src/main/scala/sbt/io/IO.scala +++ b/io/src/main/scala/sbt/io/IO.scala @@ -526,11 +526,11 @@ object IO { def withTemporaryFile[T](prefix: String, postfix: String, keepFile: Boolean)( action: File => T ): T = { - val file = File.createTempFile(prefix, postfix) + val file = Files.createTempFile(prefix, postfix) try { - action(file) + action(file.toFile()) } finally { - if (!keepFile) file.delete(); () + if (!keepFile) file.toFile().delete(); () } }