Skip to content

Commit

Permalink
Don't fail enumeration if a directory isn't available in a given arch…
Browse files Browse the repository at this point in the history
…ive.

That shouldn't be a fatal error, that's a normal case.
  • Loading branch information
icculus committed Aug 14, 2017
1 parent f425f05 commit 660171f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/physfs.c
Expand Up @@ -2433,7 +2433,17 @@ int PHYSFS_enumerate(const char *_fn, PHYSFS_EnumerateCallback cb, void *data)

else if (verifyPath(i, &arcfname, 0))
{
if ((!allowSymLinks) && (i->funcs->info.supportsSymlinks))
PHYSFS_Stat statbuf;
if (!i->funcs->stat(i->opaque, arcfname, &statbuf))
{
if (currentErrorCode() == PHYSFS_ERR_NOT_FOUND)
continue; /* no such dir in this archive, skip it. */
} /* if */

if (statbuf.filetype != PHYSFS_FILETYPE_DIRECTORY)
continue; /* not a directory in this archive, skip it. */

else if ((!allowSymLinks) && (i->funcs->info.supportsSymlinks))
{
filterdata.dirhandle = i;
filterdata.arcfname = arcfname;
Expand All @@ -2446,7 +2456,7 @@ int PHYSFS_enumerate(const char *_fn, PHYSFS_EnumerateCallback cb, void *data)
if (currentErrorCode() == PHYSFS_ERR_APP_CALLBACK)
PHYSFS_setErrorCode(filterdata.errcode);
} /* if */
} /* if */
} /* else if */
else
{
retval = i->funcs->enumerate(i->opaque, arcfname,
Expand Down

0 comments on commit 660171f

Please sign in to comment.