<filesystem>: create_directory vs create_directories return codes
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 11.2k
- Forks
- 1.7k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 22
Description
When you have path with trailing backslash the return codes of std::filesystem::create_directories and std::filesystem::create_directory for the same path are different.
My problem is that return code are
- different on
msvcbetween<experimental/filesystem>and<filesystem> - different between
msvc,clangandgcc
is someone right or is it implementation defined ?
#define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING
#include <experimental/filesystem>
#include <filesystem>
#include <iostream>
int main()
{
using std::cout;
using std::endl;
std::filesystem::remove("test1\\");
std::filesystem::remove("test2\\");
std::filesystem::remove("test3\\");
std::filesystem::remove("test4\\");
cout << "std::filesystem" <<endl;
cout << std::filesystem::create_directory("test1\\")<< "\t:create_directory" << endl;
cout << std::filesystem::create_directories("test2\\") << "\t:create_directories" << endl;
cout << "std::experimental::filesystem" << endl;
cout << std::experimental::filesystem::create_directory("test3\\") << "\t:create_directory" << endl;
cout << std::experimental::filesystem::create_directories("test4\\") << "\t:create_directories" << endl;
}
this code will output
std::filesystem
1 :create_directory
0 :create_directories
std::experimental::filesystem
1 :create_directory
1 :create_directories
code to check on other compilers wandbox link
clang output for test/
std::filesystem
1 :create_directory
0 :create_directories
gcc output for test/
std::filesystem
1 :create_directory
1 :create_directories
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the trailing-backslash example in the issue and compare create_directory with create_directories across std::filesystem and std::experimental::filesystem, using the linked Wandbox example for the compiler comparison. Check the C++ filesystem specification to determine the required return values and whether the observed differences are conforming; done means the behavior is explained and any needed STL change is identified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100