Cleaned up some __PHYSFS_platformStat() details.
This commit is contained in:
parent
de27c2a422
commit
54cc53349d
|
@ -72,7 +72,7 @@ static PHYSFS_Io *doOpen(dvoid *opaque, const char *name,
|
||||||
allocator.Free(f);
|
allocator.Free(f);
|
||||||
if (io == NULL)
|
if (io == NULL)
|
||||||
{
|
{
|
||||||
PHYSFS_Stat statbuf;
|
PHYSFS_Stat statbuf; /* !!! FIXME: this changes the error message. */
|
||||||
__PHYSFS_platformStat(f, fileExists, &statbuf);
|
__PHYSFS_platformStat(f, fileExists, &statbuf);
|
||||||
return NULL;
|
return NULL;
|
||||||
} /* if */
|
} /* if */
|
||||||
|
|
|
@ -205,13 +205,12 @@ void __PHYSFS_platformEnumerateFiles(const char *dirname,
|
||||||
|
|
||||||
strcpy(buf + dlen, ent->d_name);
|
strcpy(buf + dlen, ent->d_name);
|
||||||
|
|
||||||
if (__PHYSFS_platformStat(buf, &exists, &statbuf))
|
if (!__PHYSFS_platformStat(buf, &exists, &statbuf))
|
||||||
{
|
continue;
|
||||||
if (!exists)
|
else if (!exists)
|
||||||
continue;
|
continue; /* probably can't happen, but just in case. */
|
||||||
else if (statbuf.filetype == PHYSFS_FILETYPE_SYMLINK)
|
else if (statbuf.filetype == PHYSFS_FILETYPE_SYMLINK)
|
||||||
continue;
|
continue;
|
||||||
} /* if */
|
|
||||||
} /* if */
|
} /* if */
|
||||||
|
|
||||||
callback(callbackdata, origdir, ent->d_name);
|
callback(callbackdata, origdir, ent->d_name);
|
||||||
|
@ -389,14 +388,9 @@ int __PHYSFS_platformStat(const char *filename, int *exists, PHYSFS_Stat *st)
|
||||||
{
|
{
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
|
|
||||||
if (lstat(filename, &statbuf))
|
if (lstat(filename, &statbuf) == -1)
|
||||||
{
|
{
|
||||||
if (errno == ENOENT)
|
*exists = (errno == ENOENT);
|
||||||
{
|
|
||||||
*exists = 0;
|
|
||||||
return 0;
|
|
||||||
} /* if */
|
|
||||||
|
|
||||||
BAIL_MACRO(strerror(errno), 0);
|
BAIL_MACRO(strerror(errno), 0);
|
||||||
} /* if */
|
} /* if */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue