equal
deleted
inserted
replaced
171 val path = Path.explode("$ISABELLE_TMP_PREFIX") |
171 val path = Path.explode("$ISABELLE_TMP_PREFIX") |
172 path.file.mkdirs // low-level mkdirs |
172 path.file.mkdirs // low-level mkdirs |
173 File.platform_file(path) |
173 File.platform_file(path) |
174 } |
174 } |
175 |
175 |
176 def tmp_file(name: String, ext: String = ""): JFile = |
176 def tmp_file(name: String, ext: String = "", base_dir: JFile = isabelle_tmp_prefix()): JFile = |
177 { |
177 { |
178 val suffix = if (ext == "") "" else "." + ext |
178 val suffix = if (ext == "") "" else "." + ext |
179 val file = Files.createTempFile(isabelle_tmp_prefix().toPath, name, suffix).toFile |
179 val file = Files.createTempFile(base_dir.toPath, name, suffix).toFile |
180 file.deleteOnExit |
180 file.deleteOnExit |
181 file |
181 file |
182 } |
182 } |
183 |
183 |
184 def with_tmp_file[A](name: String, ext: String = "")(body: Path => A): A = |
184 def with_tmp_file[A](name: String, ext: String = "")(body: Path => A): A = |
215 } |
215 } |
216 ) |
216 ) |
217 } |
217 } |
218 } |
218 } |
219 |
219 |
220 def tmp_dir(name: String): JFile = |
220 def tmp_dir(name: String, base_dir: JFile = isabelle_tmp_prefix()): JFile = |
221 { |
221 { |
222 val dir = Files.createTempDirectory(isabelle_tmp_prefix().toPath, name).toFile |
222 val dir = Files.createTempDirectory(base_dir.toPath, name).toFile |
223 dir.deleteOnExit |
223 dir.deleteOnExit |
224 dir |
224 dir |
225 } |
225 } |
226 |
226 |
227 def with_tmp_dir[A](name: String)(body: Path => A): A = |
227 def with_tmp_dir[A](name: String)(body: Path => A): A = |