SDL_GetPrefPath() now uses the organization on all platforms.
authorRyan C. Gordon <icculus@icculus.org>
Wed, 23 Oct 2013 00:58:20 -0400
changeset 788362f562a475e1
parent 7882 b81e4cc2932e
child 7884 15027aa2cf21
SDL_GetPrefPath() now uses the organization on all platforms.

Even if that's not the general convention for a given platform.
src/filesystem/beos/SDL_sysfilesystem.cc
src/filesystem/cocoa/SDL_sysfilesystem.m
src/filesystem/unix/SDL_sysfilesystem.c
     1.1 --- a/src/filesystem/beos/SDL_sysfilesystem.cc	Tue Oct 22 21:54:52 2013 -0700
     1.2 +++ b/src/filesystem/beos/SDL_sysfilesystem.cc	Wed Oct 23 00:58:20 2013 -0400
     1.3 @@ -76,12 +76,12 @@
     1.4      // !!! FIXME: is there a better way to do this?
     1.5      const char *home = SDL_getenv("HOME");
     1.6      const char *append = "config/settings/";
     1.7 -    const size_t len = SDL_strlen(home) + SDL_strlen(append) + SDL_strlen(app) + 2;
     1.8 +    const size_t len = SDL_strlen(home) + SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3;
     1.9      char *retval = (char *) SDL_malloc(len);
    1.10      if (!retval) {
    1.11          SDL_OutOfMemory();
    1.12      } else {
    1.13 -        SDL_snprintf(retval, len, "%s%s%s/", home, append, app);
    1.14 +        SDL_snprintf(retval, len, "%s%s%s/%s/", home, append, org, app);
    1.15          create_directory(retval, 0700);  // BeOS api: creates missing dirs
    1.16      }
    1.17  
     2.1 --- a/src/filesystem/cocoa/SDL_sysfilesystem.m	Tue Oct 22 21:54:52 2013 -0700
     2.2 +++ b/src/filesystem/cocoa/SDL_sysfilesystem.m	Wed Oct 23 00:58:20 2013 -0400
     2.3 @@ -73,19 +73,17 @@
     2.4      NSArray *array = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
     2.5      char *retval = NULL;
     2.6  
     2.7 -    (void) org;  /* unused on Mac OS X and iOS. */
     2.8 -
     2.9      if ([array count] > 0) {  /* we only want the first item in the list. */
    2.10          NSString *str = [array objectAtIndex:0];
    2.11          const char *base = [str fileSystemRepresentation];
    2.12          if (base) {
    2.13 -            const size_t len = SDL_strlen(base) + SDL_strlen(app) + 3;
    2.14 +            const size_t len = SDL_strlen(base) + SDL_strlen(app) + 4;
    2.15              retval = (char *) SDL_malloc(len);
    2.16              if (retval == NULL) {
    2.17                  SDL_OutOfMemory();
    2.18              } else {
    2.19                  char *ptr;
    2.20 -                SDL_snprintf(retval, len, "%s/%s/", base, app);
    2.21 +                SDL_snprintf(retval, len, "%s/%s/%s/", base, org, app);
    2.22                  for (ptr = retval+1; *ptr; ptr++) {
    2.23                      if (*ptr == '/') {
    2.24                          *ptr = '\0';
     3.1 --- a/src/filesystem/unix/SDL_sysfilesystem.c	Tue Oct 22 21:54:52 2013 -0700
     3.2 +++ b/src/filesystem/unix/SDL_sysfilesystem.c	Wed Oct 23 00:58:20 2013 -0400
     3.3 @@ -178,14 +178,14 @@
     3.4      if (envr[len - 1] == '/')
     3.5          append += 1;
     3.6  
     3.7 -    len += SDL_strlen(append) + SDL_strlen(app) + 2;
     3.8 +    len += SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3;
     3.9      retval = (char *) SDL_malloc(len);
    3.10      if (!retval) {
    3.11          SDL_OutOfMemory();
    3.12          return NULL;
    3.13      }
    3.14  
    3.15 -    SDL_snprintf(retval, len, "%s%s%s/", envr, append, app);
    3.16 +    SDL_snprintf(retval, len, "%s%s%s/%s/", envr, append, org, app);
    3.17  
    3.18      for (ptr = retval+1; *ptr; ptr++) {
    3.19          if (*ptr == '/') {