Revert "path: fix bugs related to paths with trailing slashes"

It only does the right thing on unix, and the implementation
isn't great either.

This reverts commit bb1c03989f8702e06072e6d9228b52661bf00ace.