This converts the path to a format suitable for passing to Windows APIs.
mentioned in commit 3e37c46d