Skip to content

Commit

Permalink
clean up win32 support in filesystem rtl
Browse files Browse the repository at this point in the history
  • Loading branch information
LADSoft committed Sep 6, 2024
1 parent 8ad250d commit c232d9a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/clibs/cpp/libcxx/src/filesystem/directory_iterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -119,6 +120,7 @@ class __dir_stream {
ec.clear();
return;
}
advance(ec);
}

~__dir_stream() noexcept {
Expand All @@ -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;
Expand All @@ -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;
}
Expand Down

0 comments on commit c232d9a

Please sign in to comment.