remove duplicate code to EnsurePathSepAtEnd()