| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | |
| | | This software is provided 'as-is', without any express or implied |
| | | warranty. In no event will the authors be held liable for any damages |
| | |
| | | SDL_GetPrefPath(const char *org, const char *app) |
| | | { @autoreleasepool |
| | | { |
| | | char *retval = NULL; |
| | | if (!app) { |
| | | SDL_InvalidParamError("app"); |
| | | return NULL; |
| | | } |
| | | if (!org) { |
| | | org = ""; |
| | | } |
| | | |
| | | char *retval = NULL; |
| | | NSArray *array = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); |
| | | |
| | | if ([array count] > 0) { /* we only want the first item in the list. */ |
| | |
| | | SDL_OutOfMemory(); |
| | | } else { |
| | | char *ptr; |
| | | SDL_snprintf(retval, len, "%s/%s/%s/", base, org, app); |
| | | if (*org) { |
| | | SDL_snprintf(retval, len, "%s/%s/%s/", base, org, app); |
| | | } else { |
| | | SDL_snprintf(retval, len, "%s/%s/", base, app); |
| | | } |
| | | for (ptr = retval+1; *ptr; ptr++) { |
| | | if (*ptr == '/') { |
| | | *ptr = '\0'; |