gapt.utils.tempFiles.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gapt_3 Show documentation
Show all versions of gapt_3 Show documentation
General Architecture for Proof Theory
The newest version!
package gapt.utils
import os._
object withTempFile {
def apply[T](block: Path => T): T = {
val tempFile = temp(prefix = "gapt-")
try block(tempFile)
finally remove(tempFile)
}
def fromString[T](content: String)(block: Path => T): T =
withTempFile { file =>
write.over(file, content)
block(file)
}
}