29 Input/output library [input.output]

29.11 File systems [filesystems]

29.11.14 Filesystem operation functions [fs.op.funcs]

29.11.14.7 Create directory [fs.op.create.directory]

bool create_directory(const path& p); bool create_directory(const path& p, error_code& ec) noexcept;
Effects: Creates the directory p resolves to, as if by POSIX mkdir with a second argument of static_­cast<int>(perms​::​all).
If mkdir fails because p resolves to an existing directory, no error is reported.
Otherwise on failure an error is reported.
Returns: true if a new directory was created, otherwise false.
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: Creates the directory p resolves to, with attributes copied from directory existing_­p.
The set of attributes copied is operating system dependent.
If mkdir fails because p resolves to an existing directory, no error is reported.
Otherwise on failure an error is reported.
[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
]
Returns: true if a new directory was created with attributes copied from directory existing_­p, otherwise false.
Throws: As specified in [fs.err.report].