mirror of
https://github.com/decompals/wibo.git
synced 2025-06-30 18:33:43 +00:00
move empty pattern check into while loop (#81)
This commit is contained in:
parent
bcc6eae470
commit
93862405ed
@ -701,16 +701,10 @@ namespace kernel32 {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If pattern is empty, just iterate
|
||||
if (handle->pattern.empty()) {
|
||||
handle->it++;
|
||||
return handle->it != std::filesystem::directory_iterator();
|
||||
}
|
||||
|
||||
// Look for a matching file with the pattern
|
||||
while (handle->it != std::filesystem::directory_iterator()) {
|
||||
std::filesystem::path path = *handle->it;
|
||||
if (fnmatch(handle->pattern.c_str(), path.filename().c_str(), 0) == 0) {
|
||||
if (!handle->pattern.empty() && fnmatch(handle->pattern.c_str(), path.filename().c_str(), 0) == 0) {
|
||||
return true;
|
||||
}
|
||||
handle->it++;
|
||||
|
Loading…
x
Reference in New Issue
Block a user