Skip to content

Commit

Permalink
Merge pull request #1185 from eed3si9n/wip/tempfile
Browse files Browse the repository at this point in the history
Use NIO to create temp file
  • Loading branch information
eed3si9n authored May 12, 2023
2 parents 425bd1e + b01425e commit d309424
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ package internal
package inc

import java.io._
import java.nio.file.Files
import java.util.Optional
import java.util.zip.{ ZipEntry, ZipInputStream }

Expand Down Expand Up @@ -87,7 +88,7 @@ object FileAnalysisStore {
override def set(contents: AnalysisContents): Unit = {
val analysis = contents.getAnalysis
val setup = contents.getMiniSetup
val tmpAnalysisFile = File.createTempFile(file.getName, TmpEnding, tmpDir)
val tmpAnalysisFile = Files.createTempFile(tmpDir.toPath, file.getName, TmpEnding).toFile
if (!file.getParentFile.exists())
file.getParentFile.mkdirs()

Expand All @@ -113,7 +114,7 @@ object FileAnalysisStore {
def set(analysisContents: AnalysisContents): Unit = {
val analysis = analysisContents.getAnalysis
val setup = analysisContents.getMiniSetup
val tmpAnalysisFile = File.createTempFile(file.getName, ".tmp", tmpDir)
val tmpAnalysisFile = Files.createTempFile(tmpDir.toPath, file.getName, ".tmp").toFile
if (!file.getParentFile.exists()) file.getParentFile.mkdirs()
Using.zipOutputStream(new FileOutputStream(tmpAnalysisFile)) { outputStream =>
val writer = new BufferedWriter(new OutputStreamWriter(outputStream, IO.utf8))
Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ object Dependencies {
val allScalaVersions = Seq(defaultScalaVersion, scala210, scala211, scala213)
val scala212_213 = Seq(defaultScalaVersion, scala213)

private val ioVersion = nightlyVersion.getOrElse("1.8.0")
private val ioVersion = nightlyVersion.getOrElse("1.8.1")
private val utilVersion = nightlyVersion.getOrElse("1.8.2")

private val sbtIO = "org.scala-sbt" %% "io" % ioVersion
Expand Down

0 comments on commit d309424

Please sign in to comment.