a single `path_to_url` function with tests

fix for #1327

assuming this passes travis, I'll merge (for the sake of getting this in the first 1.5 beta)

I'm not 100% confident, because so many of the windows tests are failing.
will have more time this weekend to work on windows tests fixes for a subsequent beta.