[fs.op.absolute] (original) (raw)

31 Input/output library [input.output]

31.12 File systems [filesystems]

31.12.13 Filesystem operation functions [fs.op.funcs]

31.12.13.2 Absolute [fs.op.absolute]

path filesystem::absolute(const path& p); path filesystem::absolute(const path& p, error_code& ec);

Effects: Composes an absolute path referencing the same file system location as p according to the operating system ([fs.conform.os]).

Returns: The composed path.

The signature with argument ec returns path() if an error occurs.

[Note 1:

For the returned path, rp, rp.is_absolute() is trueunless an error occurs.

— _end note_]

[Note 2:

To resolve symlinks or perform other sanitization that can involve queries to secondary storage, such as hard disks, consider canonical ([fs.op.canonical]).

— _end note_]

[Note 3:

Implementations are strongly encouraged to not query secondary storage, and not consider !exists(p) an error.

— _end note_]

[Example 1:

For POSIX-based operating systems,absolute(p) is simply current_path()/p.

For Windows-based operating systems,absolute might have the same semantics as GetFullPathNameW.

— _end example_]