From 660171f79ff9bf39141b6702b0c0a31e8b133466 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 14 Aug 2017 14:05:06 -0400 Subject: [PATCH] Don't fail enumeration if a directory isn't available in a given archive. That shouldn't be a fatal error, that's a normal case. --- src/physfs.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/physfs.c b/src/physfs.c index ed80eb6..9a8b85a 100644 --- a/src/physfs.c +++ b/src/physfs.c @@ -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; @@ -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,