src/Pure/General/file.scala
changeset 56428 1acf2d76ac23
parent 54440 2c4940d2edf7
child 56783 afaec818fcfd
equal deleted inserted replaced
56427:5cbaf18d0dfb 56428:1acf2d76ac23
   140       finally { in.close }
   140       finally { in.close }
   141     }
   141     }
   142   }
   142   }
   143 
   143 
   144   def copy(path1: Path, path2: Path): Unit = copy(path1.file, path2.file)
   144   def copy(path1: Path, path2: Path): Unit = copy(path1.file, path2.file)
   145 
       
   146 
       
   147   /* tmp files */
       
   148 
       
   149   def tmp_file(prefix: String): JFile =
       
   150   {
       
   151     val file = JFile.createTempFile(prefix, null)
       
   152     file.deleteOnExit
       
   153     file
       
   154   }
       
   155 
       
   156   def with_tmp_file[A](prefix: String)(body: JFile => A): A =
       
   157   {
       
   158     val file = tmp_file(prefix)
       
   159     try { body(file) } finally { file.delete }
       
   160   }
       
   161 }
   145 }
   162 
   146