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.

### 3079. LWG 2935 forgot to fix the `existing_p` overloads of `create_directory`

Section: 29.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 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.

1. 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 create Creates 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 already exists is not 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]

   > > -5- Postconditions: `is_directory(p)`.

   > > […]