Arclight
Arclight copied to clipboard
Residual directories when using Directory::create with a malformed path
Directory::create()
(or std::filesystem::create_directories()
) will create multiple directories recursively until either the end of the path is reached or an error occurs.
When passing a path such as "a/b/c/<"
, the directories a/
, a/b/
and a/b/c/
will be created, but the creation will be interrupted by the 4th path, containing an illegal character (<
).
This will result in residual, most of the times unwanted, directories being created despite the entire operation having failed.
Directory::create()
should therefore operate as a transaction, meaning the only two possible outcomes should be 1) no directories have been created, or 2) all directories have been created.