diff options
-rw-r--r-- | Alc/alconfig.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Alc/alconfig.c b/Alc/alconfig.c index 5dbf59d2..c7c66653 100644 --- a/Alc/alconfig.c +++ b/Alc/alconfig.c @@ -36,6 +36,9 @@ #include <windows.h> #include <shlobj.h> #endif +#ifdef __APPLE__ +#include <CoreFoundation/CoreFoundation.h> +#endif #include "alMain.h" #include "alconfig.h" @@ -478,6 +481,26 @@ void ReadALConfig(void) alstr_clear(&fname); } +#ifdef __APPLE__ + CFBundleRef mainBundle = CFBundleGetMainBundle(); + if(mainBundle) + { + unsigned char fileName[MAX_PATH]; + CFURLRef configURL; + + if((configURL=CFBundleCopyResourceURL(mainBundle, CFSTR(".alsoftrc"), CFSTR(""), NULL)) && + CFURLGetFileSystemRepresentation(configURL, true, fileName, sizeof(fileName))) + { + f = al_fopen((const char*)fileName, "r"); + if(f) + { + LoadConfigFromFile(f); + fclose(f); + } + } + } +#endif + if((str=getenv("HOME")) != NULL && *str) { alstr_copy_cstr(&fname, str); |