if the path name is with trailing seperators like 'dir1/dir2/dir3/',
create_directories should process it just like 'dir1/dir2/dir3',
but according to https://godbolt.org/z/Wh3axvYM5, the trailing seperators
case was handled mistakenly, this patch fix it.
Details
Diff Detail
Event Timeline
It looks like CI is failing, so that should be addressed. Also, can you provide a link to the place where it says how create_directories should behave the way you say (I believe you, I just don't know the filesystem spec by heart and I want to check). Thanks for fixing this!
Thanks for reviewing.
The CI failing actually is involving a more complicated (possibly)misbehavior about path::parent_path() function which I am currently investigating.
As for why create_directories should behave this way, it is obvious, according to the definition of the return value of create_directories https://en.cppreference.com/w/cpp/filesystem/create_directory, that create_directories can not create the directories and return false indicating that it didn't create the directories at the same time, also I can list some supplementaries:
- GCC 8.3 has fixed this, see https://godbolt.org/z/qe8YGj9zr
- A stackoverflow discussion regarding to this, https://stackoverflow.com/questions/60130796/return-value-of-stdfilesystemcreate-directories-on-paths-with-trailing-sla
We're moving to GitHub PRs it would be great when this patch can be finished before moving. Are you interested in finishing it? If not I'll take over. Please start by rebasing the patch to see whether it passes the CI.