I have a local directory and want to share a clickable link that will open the user's default file browser.
How to generate an URL of the file://
protocol for a given local filename?
some_program /foo/bar # file:///foo/bar
some_program "/föö bar" # file:///f%C3%B6%C3%B6%20bar
some_program "$( realpath . )" # link to local directory
I found some hints for the reverse operation utilizing naive replacement commands in sed
what fails for filenames with non-alphanumeric characters like whitespace.