Encode path so slashes are preserved on windows.
Closes #323