physfs.c
changeset 103 cb5f60383994
parent 101 bd18e17ad6ad
child 122 402ee2bf165c
equal deleted inserted replaced
102:58538e10e93c 103:cb5f60383994
   650     BAIL_IF_MACRO(str == NULL, ERR_OUT_OF_MEMORY, 0);
   650     BAIL_IF_MACRO(str == NULL, ERR_OUT_OF_MEMORY, 0);
   651     sprintf(str, "%s.%s%s%s", userdir, organization, dirsep, appName);
   651     sprintf(str, "%s.%s%s%s", userdir, organization, dirsep, appName);
   652 
   652 
   653     if (!PHYSFS_setWriteDir(str))
   653     if (!PHYSFS_setWriteDir(str))
   654     {
   654     {
   655         if ( (!PHYSFS_setWriteDir(userdir)) ||
   655         if ( (PHYSFS_setWriteDir(userdir)) &&
   656              (!PHYSFS_mkdir(str + strlen(userdir))) )
   656              (PHYSFS_mkdir(str + strlen(userdir))) )
       
   657         {
       
   658             PHYSFS_setWriteDir(str);
       
   659         } /* if */
       
   660         else
   657         {
   661         {
   658             PHYSFS_setWriteDir(NULL);
   662             PHYSFS_setWriteDir(NULL);
   659             free(str);
   663             free(str);
   660             BAIL_IF_MACRO(1, ERR_CANT_SET_WRITE_DIR, 0);
   664             BAIL_IF_MACRO(1, ERR_CANT_SET_WRITE_DIR, 0);
   661         } /* if */
   665         } /* else */
   662     } /* if */
   666     } /* if */
   663 
   667 
   664         /* Put write dir related dirs on search path... */
   668     /* Put write dir first in search path... */
   665     PHYSFS_addToSearchPath(str, 1);
   669     PHYSFS_addToSearchPath(str, 0);
   666     free(str);
   670     free(str);
   667 
   671 
   668         /* Put base path on search path... */
   672         /* Put base path on search path... */
   669     PHYSFS_addToSearchPath(basedir, 1);
   673     PHYSFS_addToSearchPath(basedir, 1);
   670 
   674