From 57cac0ac709aecfc4ea4fc4c99ac3626841e0e6c Mon Sep 17 00:00:00 2001 From: TimeServ Date: Mon, 30 May 2005 12:30:41 +0000 Subject: [PATCH] fix to fs_cache/directory enumeration on windows git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1065 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/sys_win.c | 6 +++--- engine/http/iwebiface.c | 6 +++--- engine/server/sv_sys_win.c | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/engine/client/sys_win.c b/engine/client/sys_win.c index 21002da38..949acce1c 100644 --- a/engine/client/sys_win.c +++ b/engine/client/sys_win.c @@ -401,11 +401,11 @@ int Sys_EnumerateFiles (char *gpath, char *match, int (*func)(char *, int, void do { if (*fd.cFileName == '.'); //don't ever find files with a name starting with '.' - else if (fd.dwFileAttributes != 16) //is a directory + else if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) //is a directory { if (wildcmp(match, fd.cFileName)) { - sprintf(file, "%s%s", apath, fd.cFileName); + sprintf(file, "%s%s/", apath, fd.cFileName); go = func(file, fd.nFileSizeLow, parm); } } @@ -413,7 +413,7 @@ int Sys_EnumerateFiles (char *gpath, char *match, int (*func)(char *, int, void { if (wildcmp(match, fd.cFileName)) { - sprintf(file, "%s%s/", apath, fd.cFileName); + sprintf(file, "%s%s", apath, fd.cFileName); go = func(file, fd.nFileSizeLow, parm); } } diff --git a/engine/http/iwebiface.c b/engine/http/iwebiface.c index fb1c660ac..c3ad8c569 100644 --- a/engine/http/iwebiface.c +++ b/engine/http/iwebiface.c @@ -99,14 +99,14 @@ void COM_EnumerateFiles (char *match, int (*func)(char *, int, void *), void *pa do { if (*fd.cFileName == '.'); - else if (fd.dwFileAttributes != 16) //is a directory + else if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) //is a directory { - sprintf(file, "%s%s", apath, fd.cFileName); + sprintf(file, "%s%s/", apath, fd.cFileName); go = func(file, fd.nFileSizeLow, parm); } else { - sprintf(file, "%s%s/", apath, fd.cFileName); + sprintf(file, "%s%s", apath, fd.cFileName); go = func(file, fd.nFileSizeLow, parm); } } diff --git a/engine/server/sv_sys_win.c b/engine/server/sv_sys_win.c index 654c4203f..a6f539ca5 100644 --- a/engine/server/sv_sys_win.c +++ b/engine/server/sv_sys_win.c @@ -240,12 +240,7 @@ int Sys_EnumerateFiles (char *gpath, char *match, int (*func)(char *, int, void go = true; do { - if (fd.dwFileAttributes != 16) //is a directory - { - sprintf(file, "%s%s", apath, fd.cFileName); - go = func(file, fd.nFileSizeLow, parm); - } - else + if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) //is a directory { if (*fd.cFileName != '.') { @@ -253,6 +248,11 @@ int Sys_EnumerateFiles (char *gpath, char *match, int (*func)(char *, int, void go = func(file, fd.nFileSizeLow, parm); } } + else + { + sprintf(file, "%s%s", apath, fd.cFileName); + go = func(file, fd.nFileSizeLow, parm); + } } while(FindNextFile(r, &fd) && go); FindClose(r);