Skip to content

Commit

Permalink
PHYSFS_setSaneConfig() fixes: set write dir correctly, and put it at …
Browse files Browse the repository at this point in the history
…start

of search path.
  • Loading branch information
icculus committed Sep 26, 2001
1 parent 9648558 commit e444f9e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions physfs.c
Expand Up @@ -652,17 +652,21 @@ int PHYSFS_setSaneConfig(const char *organization, const char *appName,

if (!PHYSFS_setWriteDir(str))
{
if ( (!PHYSFS_setWriteDir(userdir)) ||
(!PHYSFS_mkdir(str + strlen(userdir))) )
if ( (PHYSFS_setWriteDir(userdir)) &&
(PHYSFS_mkdir(str + strlen(userdir))) )
{
PHYSFS_setWriteDir(str);
} /* if */
else
{
PHYSFS_setWriteDir(NULL);
free(str);
BAIL_IF_MACRO(1, ERR_CANT_SET_WRITE_DIR, 0);
} /* if */
} /* else */
} /* if */

/* Put write dir related dirs on search path... */
PHYSFS_addToSearchPath(str, 1);
/* Put write dir first in search path... */
PHYSFS_addToSearchPath(str, 0);
free(str);

/* Put base path on search path... */
Expand Down

0 comments on commit e444f9e

Please sign in to comment.