[fs.op.status]
31 Input/output library [input.output]
31.12 File systems [filesystems]
31.12.13 Filesystem operation functions [fs.op.funcs]
31.12.13.36 Status [fs.op.status]
file_status filesystem::status(const path& p);
Effects: As if by: error_code ec; file_status result = status(p, ec); if (result.type() == file_type::none) throw filesystem_error(implementation-supplied-message, p, ec); return result;
Throws: filesystem_error.
file_status filesystem::status(const path& p, error_code& ec) noexcept;
Effects: If possible, determines the attributes of the file p resolves to, as if by using POSIX stat to obtain a POSIX struct stat.
If, during attribute determination, the underlying file system API reports an error, sets ec to indicate the specific error reported.
Otherwise, ec.clear().
Let prms denote the result of (m & perms::mask), where m is determined as if by converting the st_mode member of the obtained struct stat to the type perms.
Returns:
If ec != error_code():
If the specific error indicates that p cannot be resolved because some element of the path does not exist, returns file_status(file_type::not_found).
Otherwise, if the specific error indicates that p can be resolved but the attributes cannot be determined, returns file_status(file_type::unknown).
Otherwise, returns file_status(file_type::none).
Otherwise,
If the attributes indicate a regular file, as if by POSIX S_ISREG, returns file_status(file_type::regular, prms).
Otherwise, if the attributes indicate a block special file, as if by POSIX S_ISBLK, returns file_status(file_type::block, prms).
Otherwise, if the attributes indicate a character special file, as if by POSIX S_ISCHR, returns file_status(file_type::character, prms).
Otherwise, if the attributes indicate a fifo or pipe file, as if by POSIX S_ISFIFO, returns file_status(file_type::fifo, prms).
Otherwise, if the attributes indicate a socket, as if by POSIX S_ISSOCK, returns file_status(file_type::socket, prms).
Otherwise, if the attributes indicate an implementation-defined file type ([fs.enum.file.type]), returns file_status(file_type::A, prms), where A is the constant for the implementation-defined file type.
Otherwise, returns file_status(file_type::unknown, prms).
Remarks: If a symbolic link is encountered during pathname resolution, pathname resolution continues using the contents of the symbolic link.