- 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);
- // sort the list alphanumerically
- return stringlistsort(start);
- }
- else
- return NULL;
+ if(hFile == -1)
+ return;
+ do {
+ adddirentry(list, path, n_file.name );
+ } while (_findnext(hFile, &n_file) == 0);
+ _findclose(hFile);
+
+ // convert names to lowercase because windows does not care, but pattern matching code often does
+ for (i = 0;i < list->numstrings;i++)
+ for (c = list->strings[i];*c;c++)
+ if (*c >= 'A' && *c <= 'Z')
+ *c += 'a' - 'A';