This question is related to another one asked here [stackoverflow]1. The C++20 standard outlines the procedure for the ”Normalization of a generic format pathname” (cpp reference uses the wording: A path can be normalized by following this algorithm. See std::filesystem::path [cpp-reference])
6 Normalization of a generic format pathname means:
- If the path is empty, stop.
- Replace each slash character in the root-name with a preferred-separator.
- Replace each directory-separator with a preferred-separator. [Note: The generic pathname grammar (29.11.7.1) defines directory-separator as one or more slashes and preferred-separators. —end note]
- Remove each dot filename and any immediately following directory-separator.
- As long as any appear, remove a non-dot-dot filename immediately followed by a directory-separator and a dot-dot filename, along with any immediately following directory-separator.
- If there is a root-directory, remove all dot-dot filenames and any directory-separators immediately following them. [Note: These dot-dot filenames attempt to refer to nonexistent parent directories. —end note]
- If the last filename is dot-dot, remove any trailing directory-separator.
- If the path is empty, add a dot.
The result of normalization is a path in normal form, which is said to be normalized.
—-ISO/IEC JTC1 SC22 WG21 N4860 29.11.7.1
Now my question is: “if the path is empty and the ‘algorithm’ stops as outlined in step 1, how will step 8 then be fulfilled by the ‘algorithm’?”
1. Disclaimer! The answer there is mine but even I with my answer am no longer convinced.
It won't. As the path is empty and there is nothing to normalize and the algorithm has been stopped at step 1 as a consequence.