Fix path joining and use forward slash exclusively.

Also added some test cases.
Merge