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
This commit is contained in:
TimeServ 2005-05-30 12:30:41 +00:00
parent 90725afe20
commit 57cac0ac70
3 changed files with 12 additions and 12 deletions

View file

@ -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);
}
}

View file

@ -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);
}
}

View file

@ -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);