summaryrefslogtreecommitdiff
path: root/src/sys/sys_win32.c
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2016-04-09 17:57:28 +0100
committerTim Angus <tim@ngus.net>2016-04-09 17:57:28 +0100
commitf45fbef604e05144057dec8d1dbfc5d4f5a2a822 (patch)
tree152d2a428b078f7a89756ea9e156695fc69f1686 /src/sys/sys_win32.c
parent7f9e97d611b4b267d9dd913144cb9632f96c90c2 (diff)
parent87abdd914988724e164ffb16380ad26be8420b84 (diff)
Merge branch 'master' into gpp
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;
}