This handles ".." at the beginning of the path, but mishandles "../.." at the beginning, so needs to be reworked.