From c232d9a5b9c5973043217e9f14c02fc750bec053 Mon Sep 17 00:00:00 2001 From: LADSoft Date: Fri, 6 Sep 2024 07:31:09 -0400 Subject: [PATCH] clean up win32 support in filesystem rtl --- .../cpp/libcxx/src/filesystem/directory_iterator.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/clibs/cpp/libcxx/src/filesystem/directory_iterator.cpp b/src/clibs/cpp/libcxx/src/filesystem/directory_iterator.cpp index 8b8a90701..8d69dbf8e 100644 --- a/src/clibs/cpp/libcxx/src/filesystem/directory_iterator.cpp +++ b/src/clibs/cpp/libcxx/src/filesystem/directory_iterator.cpp @@ -110,7 +110,8 @@ class __dir_stream { __dir_stream(const path& root, directory_options opts, error_code& ec) : __stream_(INVALID_HANDLE_VALUE), __root_(root) { - __stream_ = ::FindFirstFile(root.c_str(), &__data_); + path temp = root / "*.*"; // DAL + __stream_ = ::FindFirstFile(temp.c_str(), &__data_); if (__stream_ == INVALID_HANDLE_VALUE) { ec = error_code(::GetLastError(), generic_category()); const bool ignore_permission_denied = @@ -119,6 +120,7 @@ class __dir_stream { ec.clear(); return; } + advance(ec); } ~__dir_stream() noexcept { @@ -131,7 +133,7 @@ class __dir_stream { bool advance(error_code& ec) { while (::FindNextFile(__stream_, &__data_)) { - if (!strcmp(__data_.cFileName, ".") || strcmp(__data_.cFileName, "..")) + if (!strcmp(__data_.cFileName, ".") || !strcmp(__data_.cFileName, "..")) continue; // FIXME: Cache more of this //directory_entry::__cached_data cdata; @@ -143,7 +145,10 @@ class __dir_stream { directory_entry::__create_iter_result(detail::get_file_type(__data_))); return true; } - ec = error_code(::GetLastError(), generic_category()); + if (GetLastError() != ERROR_NO_MORE_FILES) + { + ec = error_code(::GetLastError(), generic_category()); + } close(); return false; }