Skip to content

Commit

Permalink
filesystem: re-enable folder check for array returned by listdirector…
Browse files Browse the repository at this point in the history
…y with dirs_only set to true

According to glibc manual, not all filesystems support it and some might return DT_UNKNOWN.
  • Loading branch information
a1batross committed Jan 7, 2025
1 parent d3feb6c commit cb42a0f
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions filesystem/filesystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ void listdirectory( stringlist_t *list, const char *path, qboolean dirs_only )
while(( entry = readdir( dir )))
{
// FIXME: this is a BSD extension, add check to wscript
if( dirs_only && entry->d_type != DT_DIR )
if( dirs_only && entry->d_type != DT_DIR && entry->d_type != DT_UNKNOWN )
continue;

stringlistappend( list, entry->d_name );
Expand Down Expand Up @@ -1517,10 +1517,8 @@ static void FS_ValidateDirectories( const char *path, qboolean *has_base_dir, qb

for( i = 0; i < dirs.numstrings; i++ )
{
#if 0 // re-enable if target doesn't support filtering directories only (missing d_type in struct dirent)
if( !FS_SysFolderExists( dirs.strings[i] ))
continue;
#endif

if( !Q_stricmp( fs_basedir, dirs.strings[i] ))
*has_base_dir = true;
Expand Down Expand Up @@ -1607,10 +1605,8 @@ qboolean FS_InitStdio( qboolean unused_set_to_true, const char *rootdir, const c

for( i = 0; i < dirs.numstrings; i++ )
{
#if 0 // re-enable if target doesn't support filtering directories only (missing d_type in struct dirent)
if( !FS_SysFolderExists( dirs.strings[i] ))
continue;
#endif

if( FI.games[FI.numgames] == NULL )
FI.games[FI.numgames] = Mem_Malloc( fs_mempool, sizeof( *FI.games[FI.numgames] ));
Expand All @@ -1630,10 +1626,8 @@ qboolean FS_InitStdio( qboolean unused_set_to_true, const char *rootdir, const c
{
int j;

#if 0 // re-enable if target doesn't support filtering directories only (missing d_type in struct dirent)
if( !FS_SysFolderExists( dirs.strings[i] ))
continue;
#endif

// update gameinfo from rwdir, if it's newer
// with rodir we should never create new gameinfos anymore,
Expand Down

0 comments on commit cb42a0f

Please sign in to comment.