Skip to content

Commit 9386240

Browse files
authored
move empty pattern check into while loop (#81)
1 parent bcc6eae commit 9386240

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

dll/kernel32.cpp

+1-7
Original file line numberDiff line numberDiff line change
@@ -701,16 +701,10 @@ namespace kernel32 {
701701
return false;
702702
}
703703

704-
// If pattern is empty, just iterate
705-
if (handle->pattern.empty()) {
706-
handle->it++;
707-
return handle->it != std::filesystem::directory_iterator();
708-
}
709-
710704
// Look for a matching file with the pattern
711705
while (handle->it != std::filesystem::directory_iterator()) {
712706
std::filesystem::path path = *handle->it;
713-
if (fnmatch(handle->pattern.c_str(), path.filename().c_str(), 0) == 0) {
707+
if (!handle->pattern.empty() && fnmatch(handle->pattern.c_str(), path.filename().c_str(), 0) == 0) {
714708
return true;
715709
}
716710
handle->it++;

0 commit comments

Comments
 (0)