Avoid duplicate entries when enumerating a directory

This commit is contained in:
Brian Koropoff 2007-03-20 05:55:29 +00:00 committed by Jeff Teunissen
parent e52940a3db
commit b6e52faea8

View file

@ -1595,8 +1595,21 @@ QFS_FilelistEnumerate(filelist_t* list, const char* path)
while ((dirent = readdir (dir_ptr)))
{
if (strcmp(".", dirent->d_name) && strcmp("..", dirent->d_name))
{
int j;
qboolean exists = false;
for (j = 0; j < list->count; j++)
{
if (list->list[j] && !strcmp(list->list[j], dirent->d_name))
{
exists = true;
break;
}
}
if (!exists)
QFS_FilelistAdd(list, dirent->d_name, false);
}
}
closedir (dir_ptr);
}
}