Posix path normalization

Should APIs such as PathBuf::push do some (limited) normalization in a way that preserves semantics? For example, converting the relative path a//b/.././c/ to a/b/../c/.

It would go from O(1) to O(n).

I'd hesitate to refer to std's current path-related utilities as anything POSIX-like. E.g. any normalization that's based on Components would likely strip off ending directory indicators (trailing / or /.).

Right, there would need to be care.taken to make sure it's semantically the same path.

(btw, I think components should ideally not change paths semantics either, but that's perhaps a different discussion)

Note that // at the beginning of a path has semantic meaning even on POSIX.

4 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.