[libcxx-commits] [PATCH] D93026: [libc++] [P1164] Add tests for create_directories. NFC.
Marek Kurdej via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Dec 11 00:53:36 PST 2020
curdeius added a comment.
Regarding https://reviews.llvm.org/D92769#inline-868480. @mstorsjo
> If parent does exist, but isn't a directory, the check `if (not exists(parent_st))` above won't trigger, so it won't hit the case of calling `__create_directory("parent_which_is_file")`, but will instead call `__create_directory("parent_which_is_file/subdir")`. That call doesn't return the error code corresponding to `EEXIST`, but gives an error corresponding to `no_such_file_or_directory`/`ENOENT` instead.
>
> By extending the check above into `if (not exists(parent_st)) { ... } else if (!is_directory(parent)) return err.report(errc::file_exists);`, one would get the more expected error code here too.
MS STL has indeed a special handling of errors while creating directories. See https://github.com/microsoft/STL/blob/68b344c9dcda6ddf1a8fca112cb9033f9e50e787/stl/inc/filesystem#L3766-L3777
I think we can do something similar indeed, so that the error that pops up is the error the one would expect.
I'll take a look at the tests they do and try to improve handling in libc++.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D93026/new/
https://reviews.llvm.org/D93026
More information about the libcxx-commits
mailing list