Fixed trimDots() for paths that contain ".." in the middle