Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filepath2uri function? #61

Open
stevengj opened this issue Dec 2, 2024 · 0 comments
Open

filepath2uri function? #61

stevengj opened this issue Dec 2, 2024 · 0 comments

Comments

@stevengj
Copy link

stevengj commented Dec 2, 2024

Might be nice to have an API to convert file paths to URI paths and file:// URIs, e.g. something like:

filepath2uripath(path::AbstractString) = join(map(escapeuri, Base.splitpath(path)), '/')
filepath2uri(path::AbstractString) = "file://" * filepath2uripath(path)
filepath2uri(host::AbstractString, path::AbstractString) = "file://" * host * "/" * filepath2uripath(path)

as discussed on discourse.

(There might be some additional wrinkles, e.g. in the treatment of absolute vs. relative paths or Windows \\server\path UNC paths.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant