src/Pure/General/file.scala
changeset 74811 1f40ded31b78
parent 73945 e61add9d5b5e
child 75202 4fdde010086f
equal deleted inserted replaced
74810:d540c36cd0d2 74811:1f40ded31b78
   290   {
   290   {
   291     if (Platform.is_windows && flag) Isabelle_System.chmod("a+x", path)
   291     if (Platform.is_windows && flag) Isabelle_System.chmod("a+x", path)
   292     else if (Platform.is_windows) Isabelle_System.chmod("a-x", path)
   292     else if (Platform.is_windows) Isabelle_System.chmod("a-x", path)
   293     else path.file.setExecutable(flag, false)
   293     else path.file.setExecutable(flag, false)
   294   }
   294   }
       
   295 
       
   296 
       
   297   /* content */
       
   298 
       
   299   object Content
       
   300   {
       
   301     def apply(path: Path, content: Bytes): Content = new Content_Bytes(path, content)
       
   302     def apply(path: Path, content: String): Content = new Content_String(path, content)
       
   303     def apply(path: Path, content: XML.Body): Content_XML = new Content_XML(path, content)
       
   304   }
       
   305 
       
   306   trait Content
       
   307   {
       
   308     def path: Path
       
   309     def write(dir: Path): Unit
       
   310   }
       
   311 
       
   312   final class Content_Bytes private[File](val path: Path, content: Bytes) extends Content
       
   313   {
       
   314     def write(dir: Path): Unit = Bytes.write(dir + path, content)
       
   315   }
       
   316 
       
   317   final class Content_String private[File](val path: Path, content: String) extends Content
       
   318   {
       
   319     def write(dir: Path): Unit = File.write(dir + path, content)
       
   320   }
       
   321 
       
   322   final class Content_XML private[File](val path: Path, content: XML.Body)
       
   323   {
       
   324     def output(out: XML.Body => String): Content_String =
       
   325       new Content_String(path, out(content))
       
   326   }
   295 }
   327 }