Sanitize paths uniformly, in a Windows-friendly way.

Fixes kinda a #1948 thing.
Related to #1946.