30 Input/output library [input.output]

30.10 File systems [filesystems]

30.10.15 Filesystem operation functions [fs.op.funcs]

30.10.15.2 Canonical [fs.op.canonical]

path canonical(const path& p, const path& base = current_path()); path canonical(const path& p, error_code& ec); path canonical(const path& p, const path& base, error_code& ec);
Effects: Converts p, which must exist, to an absolute path that has no symbolic link, dot, or dot-dot elements in its pathname in the generic format.
Returns: A path that refers to the same file system object as absolute(p, base).
For the overload without a base argument, base is current_­path().
Signatures with argument ec return path() if an error occurs.
Throws: As specified in [fs.err.report].
Remarks: !exists(p) is an error.