src/Pure/General/file.scala
changeset 66232 be0ab4b94c62
parent 65589 f70c617e9c26
child 66233 7188967253e5
equal deleted inserted replaced
66231:406b5ae7f5f3 66232:be0ab4b94c62
    44       }
    44       }
    45     }
    45     }
    46     else platform_path
    46     else platform_path
    47 
    47 
    48   def standard_path(file: JFile): String = standard_path(file.getPath)
    48   def standard_path(file: JFile): String = standard_path(file.getPath)
    49 
       
    50   def path(file: JFile): Path = Path.explode(standard_path(file))
       
    51   def pwd(): Path = path(Path.current.file.toPath.toAbsolutePath.toFile)
       
    52 
    49 
    53   def standard_url(name: String): String =
    50   def standard_url(name: String): String =
    54     try {
    51     try {
    55       val url = new URL(name)
    52       val url = new URL(name)
    56       if (url.getProtocol == "file" && Url.is_wellformed_file(name))
    53       if (url.getProtocol == "file" && Url.is_wellformed_file(name))
    95 
    92 
    96   def platform_path(path: Path): String = platform_path(standard_path(path))
    93   def platform_path(path: Path): String = platform_path(standard_path(path))
    97   def platform_file(path: Path): JFile = new JFile(platform_path(path))
    94   def platform_file(path: Path): JFile = new JFile(platform_path(path))
    98 
    95 
    99 
    96 
       
    97   /* platform files */
       
    98 
       
    99   def absolute(file: JFile): JFile = file.toPath.toAbsolutePath.normalize.toFile
       
   100   def canonical(file: JFile): JFile = file.getCanonicalFile
       
   101 
       
   102   def path(file: JFile): Path = Path.explode(standard_path(file))
       
   103   def pwd(): Path = path(Path.current.absolute_file)
       
   104 
       
   105 
   100   /* bash path */
   106   /* bash path */
   101 
   107 
   102   def bash_path(path: Path): String = Bash.string(standard_path(path))
   108   def bash_path(path: Path): String = Bash.string(standard_path(path))
   103   def bash_path(file: JFile): String = Bash.string(standard_path(file))
   109   def bash_path(file: JFile): String = Bash.string(standard_path(file))
   104 
   110