summaryrefslogtreecommitdiff
path: root/src/sys/sys_win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sys/sys_win32.c')
-rw-r--r--src/sys/sys_win32.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/sys/sys_win32.c b/src/sys/sys_win32.c
index a2554b89..d8e589b0 100644
--- a/src/sys/sys_win32.c
+++ b/src/sys/sys_win32.c
@@ -412,6 +412,7 @@ char **Sys_ListFiles( const char *directory, const char *extension, char *filter
intptr_t findhandle;
int flag;
int i;
+ int extLen;
if (filter) {
@@ -445,6 +446,8 @@ char **Sys_ListFiles( const char *directory, const char *extension, char *filter
flag = _A_SUBDIR;
}
+ extLen = strlen( extension );
+
Com_sprintf( search, sizeof(search), "%s\\*%s", directory, extension );
// search
@@ -458,6 +461,14 @@ char **Sys_ListFiles( const char *directory, const char *extension, char *filter
do {
if ( (!wantsubs && flag ^ ( findinfo.attrib & _A_SUBDIR )) || (wantsubs && findinfo.attrib & _A_SUBDIR) ) {
+ if (*extension) {
+ if ( strlen( findinfo.name ) < extLen ||
+ Q_stricmp(
+ findinfo.name + strlen( findinfo.name ) - extLen,
+ extension ) ) {
+ continue; // didn't match
+ }
+ }
if ( nfiles == MAX_FOUND_FILES - 1 ) {
break;
}