src/Pure/System/cygwin.scala
changeset 52680 c16f35e5a5aa
parent 52662 c7cae5ce217d
parent 52679 24e02408feed
child 52681 8cc7f76b827a
child 52682 77146b576ac7
equal deleted inserted replaced
52662:c7cae5ce217d 52680:c16f35e5a5aa
     1 /*  Title:      Pure/System/cygwin.scala
       
     2     Author:     Makarius
       
     3 
       
     4 Support for Cygwin.
       
     5 */
       
     6 
       
     7 package isabelle
       
     8 
       
     9 
       
    10 import java.io.{File => JFile}
       
    11 import java.nio.file.{Paths, Files}
       
    12 
       
    13 
       
    14 object Cygwin
       
    15 {
       
    16   /* symlinks */
       
    17 
       
    18   def write_symlink(file: JFile, content: String)
       
    19   {
       
    20     require(Platform.is_windows)
       
    21 
       
    22     val path = file.toPath
       
    23 
       
    24     val writer = Files.newBufferedWriter(path, UTF8.charset)
       
    25     try { writer.write("!<symlink>" + content + "\0") }
       
    26     finally { writer.close }
       
    27 
       
    28     Files.setAttribute(path, "dos:system", true)
       
    29   }
       
    30 }
       
    31