27 Input/output library [input.output]

27.10 File systems [filesystems]

27.10.15 Filesystem operation functions [fs.op.funcs]

27.10.15.7 Create directory [fs.op.create_directory]

bool create_directory(const path& p); bool create_directory(const path& p, error_code& ec) noexcept;

Effects: Establishes the postcondition by attempting to create the directory p resolves to, as if by POSIX mkdir() with a second argument of static_cast<int>(perms::all). Creation failure because p resolves to an existing directory shall not be treated as an error.

Postconditions: is_directory(p).

Returns: true if a new directory was created, otherwise false. The signature with argument ec returns false if an error occurs.

Throws: As specified in [fs.err.report].

bool create_directory(const path& p, const path& existing_p); bool create_directory(const path& p, const path& existing_p, error_code& ec) noexcept;

Effects: Establishes the postcondition by attempting to create the directory p resolves to, with attributes copied from directory existing_p. The set of attributes copied is operating system dependent. Creation failure because p resolves to an existing directory shall not be treated as an error. [ Note: For POSIX-based operating systems, the attributes are those copied by native API stat(existing_p.c_str(), &attributes_stat) followed by mkdir(p.c_str(), attributes_stat.st_mode). For Windows-based operating systems, the attributes are those copied by native API CreateDirectoryExW(existing_p.c_str(), p.c_str(), 0).  — end note ]

Postconditions: is_directory(p).

Returns: true if a new directory was created, otherwise false. The signature with argument ec returns false if an error occurs.

Throws: As specified in [fs.err.report].