src/Pure/System/isabelle_system.scala
changeset 56449 f0592485b7fb
parent 56428 1acf2d76ac23
child 56477 57b5c8db55f1
equal deleted inserted replaced
56448:344800503974 56449:f0592485b7fb
    10 
    10 
    11 import java.util.regex.Pattern
    11 import java.util.regex.Pattern
    12 import java.io.{File => JFile, BufferedReader, InputStreamReader,
    12 import java.io.{File => JFile, BufferedReader, InputStreamReader,
    13   BufferedWriter, OutputStreamWriter}
    13   BufferedWriter, OutputStreamWriter}
    14 import java.nio.file.Files
    14 import java.nio.file.Files
       
    15 import java.net.{URL, URLDecoder, MalformedURLException}
    15 
    16 
    16 import scala.util.matching.Regex
    17 import scala.util.matching.Regex
    17 
    18 
    18 
    19 
    19 object Isabelle_System
    20 object Isabelle_System
   188     }
   189     }
   189     else jvm_path
   190     else jvm_path
   190 
   191 
   191   def posix_path(file: JFile): String = posix_path(file.getPath)
   192   def posix_path(file: JFile): String = posix_path(file.getPath)
   192 
   193 
       
   194   def posix_path_url(name: String): String =
       
   195     try {
       
   196       val url = new URL(name)
       
   197       if (url.getProtocol == "file")
       
   198         posix_path(URLDecoder.decode(url.getPath, UTF8.charset_name))
       
   199       else name
       
   200     }
       
   201     catch { case _: MalformedURLException => posix_path(name) }
       
   202 
   193 
   203 
   194   /* misc path specifications */
   204   /* misc path specifications */
   195 
   205 
   196   def standard_path(path: Path): String = path.expand.implode
   206   def standard_path(path: Path): String = path.expand.implode
   197 
   207