- hFile = _findfirst(pattern, &n_file);
- if(hFile != -1)
- {
- // start a new chain with the the first name
- start = current = stringlistappend(NULL, n_file.name);
- // iterate through the directory
- while (_findnext(hFile, &n_file) == 0)
- current = stringlistappend(current, n_file.name);
- _findclose(hFile);
-
- // convert names to lowercase because windows does not care, but pattern matching code often does
- for (current = start;current;current = current->next)
- for (c = current->text;*c;c++)
- if (*c >= 'A' && *c <= 'Z')
- *c += 'a' - 'A';
+ hFile = FindFirstFile(pattern, &n_file);
+ if(hFile == INVALID_HANDLE_VALUE)
+ return;
+ do {
+ adddirentry(list, path, n_file.cFileName);
+ } while (FindNextFile(hFile, &n_file) != 0);
+ FindClose(hFile);