code to simplify a path and reduce . and ..