From: lordhavoc Date: Sat, 30 Mar 2002 03:04:49 +0000 (+0000) Subject: force filenames to lowercase in listdirectory code on windows X-Git-Tag: RELEASE_0_2_0_RC1~545 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=e76cee9d87cd85055a93db1e520f47f43241cc0d force filenames to lowercase in listdirectory code on windows git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@1691 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/filematch.c b/filematch.c index 9ac64913..9e0eceaf 100644 --- a/filematch.c +++ b/filematch.c @@ -113,7 +113,7 @@ stringlist_t *stringlistsort(stringlist_t *start) #include stringlist_t *listdirectory(char *path) { - char pattern[4096]; + char pattern[4096], *c; struct _finddata_t n_file; long hFile; stringlist_t *start, *current; @@ -129,8 +129,16 @@ stringlist_t *listdirectory(char *path) 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'; + // sort the list alphanumerically - return stringlistsort(start); + start = stringlistsort(start); + return start; } else return NULL;