src/Pure/General/url.scala
changeset 65188 50cfc6775361
parent 65069 1995b421d8ef
child 66234 836898197296
equal deleted inserted replaced
65187:9250f944ec0f 65188:50cfc6775361
     6 
     6 
     7 package isabelle
     7 package isabelle
     8 
     8 
     9 
     9 
    10 import java.io.{File => JFile}
    10 import java.io.{File => JFile}
    11 import java.nio.file.Paths
    11 import java.nio.file.{Paths, FileSystemNotFoundException}
    12 import java.net.{URI, URISyntaxException}
    12 import java.net.{URI, URISyntaxException}
    13 import java.net.{URL, MalformedURLException}
    13 import java.net.{URL, MalformedURLException}
    14 import java.util.zip.GZIPInputStream
    14 import java.util.zip.GZIPInputStream
    15 
    15 
    16 
    16 
    54 
    54 
    55   def parse_file(uri: String): JFile = Paths.get(new URI(uri)).toFile
    55   def parse_file(uri: String): JFile = Paths.get(new URI(uri)).toFile
    56 
    56 
    57   def is_wellformed_file(uri: String): Boolean =
    57   def is_wellformed_file(uri: String): Boolean =
    58     try { parse_file(uri); true }
    58     try { parse_file(uri); true }
    59     catch { case _: URISyntaxException | _: IllegalArgumentException => false }
    59     catch {
       
    60       case _: URISyntaxException | _: IllegalArgumentException | _: FileSystemNotFoundException =>
       
    61         false
       
    62     }
    60 
    63 
    61   def canonical_file(uri: String): JFile = parse_file(uri).getCanonicalFile
    64   def canonical_file(uri: String): JFile = parse_file(uri).getCanonicalFile
    62   def canonical_file_name(uri: String): String = canonical_file(uri).getPath
    65   def canonical_file_name(uri: String): String = canonical_file(uri).getPath
    63 }
    66 }