Packages (Windows): optimise

This commit is contained in:
李通洲
2023-02-09 09:51:51 +08:00
parent ff170caff6
commit 3a9403a2f1
+6 -1
View File
@@ -7,6 +7,7 @@
static uint32_t getNumElements(const char* searchPath /* including `\*` suffix */, DWORD type, const char* ignore)
{
uint32_t counter = 0;
bool flag = ignore == NULL;
WIN32_FIND_DATAA wfd;
HANDLE hFind = FindFirstFileA(searchPath, &wfd);
@@ -15,7 +16,11 @@ static uint32_t getNumElements(const char* searchPath /* including `\*` suffix *
do // Managed to locate and create an handle to that folder.
{
if(!(wfd.dwFileAttributes & type)) continue;
if(ignore != NULL && strcasecmp(ignore, wfd.cFileName) == 0) continue;
if(!flag && strcasecmp(ignore, wfd.cFileName) == 0)
{
flag = true;
continue;
}
counter++;
} while (FindNextFileA(hFind, &wfd));
FindClose(hFind);