Skip to content
Permalink
Browse files
Make PHYSFS_exists() work with mounts from PHYSFS_mountIo(io, NULL, ...)
(Actually, from any mount function that accepts a bogus/NULL filename.)
  • Loading branch information
icculus committed Aug 14, 2017
1 parent 3b7ee39 commit cfe3f0180b33aa7e7b5777493406c561092490da
Showing with 11 additions and 5 deletions.
  1. +11 −5 src/physfs.c
@@ -2170,9 +2170,9 @@ int PHYSFS_delete(const char *_fname)
} /* PHYSFS_delete */


const char *PHYSFS_getRealDir(const char *_fname)
static DirHandle *getRealDirHandle(const char *_fname)
{
const char *retval = NULL;
DirHandle *retval = NULL;
char *fname = NULL;
size_t len;

@@ -2189,15 +2189,15 @@ const char *PHYSFS_getRealDir(const char *_fname)
char *arcfname = fname;
if (partOfMountPoint(i, arcfname))
{
retval = i->dirName;
retval = i;
break;
} /* if */
else if (verifyPath(i, &arcfname, 0))
{
PHYSFS_Stat statbuf;
if (i->funcs->stat(i->opaque, arcfname, &statbuf))
{
retval = i->dirName;
retval = i;
break;
} /* if */
} /* if */
@@ -2207,6 +2207,12 @@ const char *PHYSFS_getRealDir(const char *_fname)

__PHYSFS_smallFree(fname);
return retval;
} /* getRealDirHandle */

const char *PHYSFS_getRealDir(const char *fname)
{
DirHandle *dh = getRealDirHandle(fname);
return dh ? dh->dirName : NULL;
} /* PHYSFS_getRealDir */


@@ -2482,7 +2488,7 @@ void PHYSFS_enumerateFilesCallback(const char *fname,

int PHYSFS_exists(const char *fname)
{
return (PHYSFS_getRealDir(fname) != NULL);
return (getRealDirHandle(fname) != NULL);
} /* PHYSFS_exists */


0 comments on commit cfe3f01

Please sign in to comment.