mirror of
https://github.com/decompals/wibo.git
synced 2025-07-06 05:05:51 +00:00
findNextFile improvement (#82)
* move empty pattern check into while loop * early return if pattern is empty * comment
This commit is contained in:
parent
93862405ed
commit
c01d9a25b9
@ -701,10 +701,15 @@ namespace kernel32 {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Early return if pattern is empty
|
||||||
|
if (handle->pattern.empty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// 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 (!handle->pattern.empty() && fnmatch(handle->pattern.c_str(), path.filename().c_str(), 0) == 0) {
|
if (fnmatch(handle->pattern.c_str(), path.filename().c_str(), 0) == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
handle->it++;
|
handle->it++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user