SDL_GetPrefPath() now uses the organization on all platforms. Even if that's not the general convention for a given platform.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
diff --git a/src/filesystem/beos/SDL_sysfilesystem.cc b/src/filesystem/beos/SDL_sysfilesystem.cc
index decf84c..dc7a970 100644
--- a/src/filesystem/beos/SDL_sysfilesystem.cc
+++ b/src/filesystem/beos/SDL_sysfilesystem.cc
@@ -76,12 +76,12 @@ SDL_GetPrefPath(const char *org, const char *app)
// !!! FIXME: is there a better way to do this?
const char *home = SDL_getenv("HOME");
const char *append = "config/settings/";
- const size_t len = SDL_strlen(home) + SDL_strlen(append) + SDL_strlen(app) + 2;
+ const size_t len = SDL_strlen(home) + SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3;
char *retval = (char *) SDL_malloc(len);
if (!retval) {
SDL_OutOfMemory();
} else {
- SDL_snprintf(retval, len, "%s%s%s/", home, append, app);
+ SDL_snprintf(retval, len, "%s%s%s/%s/", home, append, org, app);
create_directory(retval, 0700); // BeOS api: creates missing dirs
}
diff --git a/src/filesystem/cocoa/SDL_sysfilesystem.m b/src/filesystem/cocoa/SDL_sysfilesystem.m
index 67ae24a..760830a 100644
--- a/src/filesystem/cocoa/SDL_sysfilesystem.m
+++ b/src/filesystem/cocoa/SDL_sysfilesystem.m
@@ -73,19 +73,17 @@ SDL_GetPrefPath(const char *org, const char *app)
NSArray *array = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
char *retval = NULL;
- (void) org; /* unused on Mac OS X and iOS. */
-
if ([array count] > 0) { /* we only want the first item in the list. */
NSString *str = [array objectAtIndex:0];
const char *base = [str fileSystemRepresentation];
if (base) {
- const size_t len = SDL_strlen(base) + SDL_strlen(app) + 3;
+ const size_t len = SDL_strlen(base) + SDL_strlen(app) + 4;
retval = (char *) SDL_malloc(len);
if (retval == NULL) {
SDL_OutOfMemory();
} else {
char *ptr;
- SDL_snprintf(retval, len, "%s/%s/", base, app);
+ SDL_snprintf(retval, len, "%s/%s/%s/", base, org, app);
for (ptr = retval+1; *ptr; ptr++) {
if (*ptr == '/') {
*ptr = '\0';
diff --git a/src/filesystem/unix/SDL_sysfilesystem.c b/src/filesystem/unix/SDL_sysfilesystem.c
index e1d06c4..0f6e62e 100644
--- a/src/filesystem/unix/SDL_sysfilesystem.c
+++ b/src/filesystem/unix/SDL_sysfilesystem.c
@@ -178,14 +178,14 @@ SDL_GetPrefPath(const char *org, const char *app)
if (envr[len - 1] == '/')
append += 1;
- len += SDL_strlen(append) + SDL_strlen(app) + 2;
+ len += SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3;
retval = (char *) SDL_malloc(len);
if (!retval) {
SDL_OutOfMemory();
return NULL;
}
- SDL_snprintf(retval, len, "%s%s%s/", envr, append, app);
+ SDL_snprintf(retval, len, "%s%s%s/%s/", envr, append, org, app);
for (ptr = retval+1; *ptr; ptr++) {
if (*ptr == '/') {