On Windows, when the find directory is finished, the handle is not closed.
actboy168 opened this issue · 2 comments
actboy168 commented
Describe the bug
I'm not sure if this meets the C++ standard, but both msvc and mingw implementations do this.
To Reproduce
auto path = fs::path("test/");
fs::create_directory(path);
auto itor = fs::directory_iterator(path);
while (itor != fs::directory_iterator()) {
++itor;
}
fs::remove_all(path);
fs::create_directory(path); // throw an exception
When itor is equal to end(), it releases the resources held by itor. fs::create_directory will not throw an exception.
Expected behavior
The second fs::create_directory works fine.
Additional context
gulrak commented
Yeah, the standard doesn't specify detailed enough, but that code works on C++17 std::filesystem of GCC8 on macOS and Linux and my own POSIX implementation, so I agree, it should work.
gulrak commented
Closed with release of v1.0.8