Use SplitPath before JoinPath or else bad things happen.

The first element for JoinPath is special, it is meant to be drive
letter or something like that, it isn't meant to be a directory.
A slash is not inserted between it and the following element.