mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
Avoid duplicate entries when enumerating a directory
This commit is contained in:
parent
e52940a3db
commit
b6e52faea8
1 changed files with 14 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue