src/filesystem/cocoa/SDL_sysfilesystem.m
changeset 7883 62f562a475e1
parent 7866 42da269b7977
child 7891 b34f5e226458
equal deleted inserted replaced
7882:b81e4cc2932e 7883:62f562a475e1
    71 {
    71 {
    72     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    72     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    73     NSArray *array = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
    73     NSArray *array = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
    74     char *retval = NULL;
    74     char *retval = NULL;
    75 
    75 
    76     (void) org;  /* unused on Mac OS X and iOS. */
       
    77 
       
    78     if ([array count] > 0) {  /* we only want the first item in the list. */
    76     if ([array count] > 0) {  /* we only want the first item in the list. */
    79         NSString *str = [array objectAtIndex:0];
    77         NSString *str = [array objectAtIndex:0];
    80         const char *base = [str fileSystemRepresentation];
    78         const char *base = [str fileSystemRepresentation];
    81         if (base) {
    79         if (base) {
    82             const size_t len = SDL_strlen(base) + SDL_strlen(app) + 3;
    80             const size_t len = SDL_strlen(base) + SDL_strlen(app) + 4;
    83             retval = (char *) SDL_malloc(len);
    81             retval = (char *) SDL_malloc(len);
    84             if (retval == NULL) {
    82             if (retval == NULL) {
    85                 SDL_OutOfMemory();
    83                 SDL_OutOfMemory();
    86             } else {
    84             } else {
    87                 char *ptr;
    85                 char *ptr;
    88                 SDL_snprintf(retval, len, "%s/%s/", base, app);
    86                 SDL_snprintf(retval, len, "%s/%s/%s/", base, org, app);
    89                 for (ptr = retval+1; *ptr; ptr++) {
    87                 for (ptr = retval+1; *ptr; ptr++) {
    90                     if (*ptr == '/') {
    88                     if (*ptr == '/') {
    91                         *ptr = '\0';
    89                         *ptr = '\0';
    92                         mkdir(retval, 0700);
    90                         mkdir(retval, 0700);
    93                         *ptr = '/';
    91                         *ptr = '/';