PHYSFS_setWriteDir() shouldn't create an empty file if the dir doesn't exist.
(transplanted from 2653b3bc19c9ba7d1e6bf53566719e4e30935382)
This commit is contained in:
parent
b1c6c7f4a8
commit
4a56820f1d
15
src/physfs.c
15
src/physfs.c
|
@ -879,13 +879,20 @@ static DirHandle *openDirectory(PHYSFS_Io *io, const char *d, int forWriting)
|
||||||
|
|
||||||
if (io == NULL)
|
if (io == NULL)
|
||||||
{
|
{
|
||||||
|
/* file doesn't exist, etc? Just fail out. */
|
||||||
|
PHYSFS_Stat statbuf;
|
||||||
|
BAIL_IF_ERRPASS(!__PHYSFS_platformStat(d, &statbuf, 1), NULL);
|
||||||
|
|
||||||
/* DIR gets first shot (unlike the rest, it doesn't deal with files). */
|
/* DIR gets first shot (unlike the rest, it doesn't deal with files). */
|
||||||
retval = tryOpenDir(io, &__PHYSFS_Archiver_DIR, d, forWriting, &claimed);
|
if (statbuf.filetype == PHYSFS_FILETYPE_DIRECTORY)
|
||||||
if (retval || claimed)
|
{
|
||||||
return retval;
|
retval = tryOpenDir(io, &__PHYSFS_Archiver_DIR, d, forWriting, &claimed);
|
||||||
|
if (retval || claimed)
|
||||||
|
return retval;
|
||||||
|
} /* if */
|
||||||
|
|
||||||
io = __PHYSFS_createNativeIo(d, forWriting ? 'w' : 'r');
|
io = __PHYSFS_createNativeIo(d, forWriting ? 'w' : 'r');
|
||||||
BAIL_IF_ERRPASS(!io, 0);
|
BAIL_IF_ERRPASS(!io, NULL);
|
||||||
created_io = 1;
|
created_io = 1;
|
||||||
} /* if */
|
} /* if */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue