This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++20 status.
existing_p
overloads of create_directory
Section: 31.12.13.8 [fs.op.create.directory] Status: C++20 Submitter: Billy O'Neal III Opened: 2018-03-07 Last modified: 2021-06-06
Priority: 0
View all issues with C++20 status.
Discussion:
LWG 2935(i) clarified that create_directory
is not supposed to report an error if
exists(p)
, even if p
is not a directory. However, the P/R there missed the
existing_p
overloads.
[ 2018-03-27 Moved to Tentatively Ready after 6 positive votes on c++std-lib. ]
[2018-06 Rapperswil: Adopted]
Proposed resolution:
This wording is relative to N4727.
Edit [fs.op.create_directory] as indicated:
bool create_directory(const path& p, const path& existing_p); bool create_directory(const path& p, const path& existing_p, error_code& ec) noexcept;-4- Effects:
Establishes the postcondition by attempting to createCreates the directoryp
resolves to, with attributes copied from directoryexisting_p
. The set of attributes copied is operating system dependent. Creation failure becausep
resolves to an existing directory shall not be treated asalready exists is not an error. [Note: For POSIX-based operating systems, the attributes are those copied by native APIstat(existing_p.c_str(), &attributes_stat)
followed bymkdir(p.c_str(), attributes_stat.st_mode)
. For Windows-based operating systems, the attributes are those copied by native APICreateDirectoryExW(existing_p.c_str(), p.c_str(), 0)
. — end note]-5- Postconditions:[…]is_directory(p)
.