FilePaths.jl icon indicating copy to clipboard operation
FilePaths.jl copied to clipboard

Support the "file" URI scheme

Open omus opened this issue 4 years ago • 1 comments

It would be good if the "file" URI scheme was supported as defined in: https://datatracker.ietf.org/doc/html/rfc8089

More specifically I was trying to use the "file" URI with mkpath which did not work as expected:

julia> using FilePaths, URIs

julia> using FilePathsBase: /

julia> uri = URI(cwd() / p"test/runtests.jl")
URI("file:///private/tmp/demo/test/runtests.jl")

julia> p = Path(string(uri))
p"file:/private/tmp/demo/test/runtests.jl"

julia> mkpath(dirname(p))
p"file:/private/tmp/demo/test"

julia> readdir(cwd())
1-element Vector{String}:
 "file:"

julia> collect(walkdir(cwd()))
6-element Vector{Tuple{String, Vector{String}, Vector{String}}}:
 ("/private/tmp/demo", ["file:"], [])
 ("/private/tmp/demo/file:", ["private"], [])
 ("/private/tmp/demo/file:/private", ["tmp"], [])
 ("/private/tmp/demo/file:/private/tmp", ["demo"], [])
 ("/private/tmp/demo/file:/private/tmp/demo", ["test"], [])
 ("/private/tmp/demo/file:/private/tmp/demo/test", [], [])

omus avatar Aug 17 '21 14:08 omus

That doesn't work in base Julia either though. I think that should probably be a different path type.

rofinn avatar Aug 17 '21 17:08 rofinn