mirror of https://github.com/decompals/wibo.git
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;
|
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
|
// Look for a matching file with the pattern
|
||||||
while (handle->it != std::filesystem::directory_iterator()) {
|
while (handle->it != std::filesystem::directory_iterator()) {
|
||||||
std::filesystem::path path = *handle->it;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
handle->it++;
|
handle->it++;
|
||||||
|
|
Loading…
Reference in New Issue