I'd like to simplify a path containing parent directory (..
) references, but without making it absolute.
E.g., a path like foo/bar/../baz
should be simplified to foo/baz
since the bar/..
part cancels out1.
1 Strictly speaking, this is not true if bar
is a symlink somewhere else - but feel free to ignore this: I don't care if the simplification returns different results than the original path in the presence of symlinks.
foo/bar/../baz
is not necessarily the same asfoo/baz
iffoo/bar
is a synlink. – Stéphane Chazelas Dec 05 '19 at 21:37