diff options
author | Chris Robinson <[email protected]> | 2016-06-04 10:45:44 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-06-04 10:45:44 -0700 |
commit | 0477d6159974837ee01bbc7c74a65a3be5794cdd (patch) | |
tree | d69c5e5ad3133f05c5399b70c3cac87373cf59f5 /Alc/alcConfig.c | |
parent | b2041a5ddfec78bbde1c63c8674614455ee31f93 (diff) |
Look in the executable's dir for another config file
On Windows it'll look for alsoft.ini, and elsewhere is alsoft.conf. This
applies after the user-local settings and before ALSOFT_CONF.
Diffstat (limited to 'Alc/alcConfig.c')
-rw-r--r-- | Alc/alcConfig.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Alc/alcConfig.c b/Alc/alcConfig.c index 6fc9db33..f83ffd94 100644 --- a/Alc/alcConfig.c +++ b/Alc/alcConfig.c @@ -313,6 +313,7 @@ void ReadALConfig(void) { WCHAR buffer[PATH_MAX]; const WCHAR *str; + al_string ppath; FILE *f; if(SHGetSpecialFolderPathW(NULL, buffer, CSIDL_APPDATA, FALSE) != FALSE) @@ -331,6 +332,19 @@ void ReadALConfig(void) al_string_deinit(&filepath); } + ppath = GetProcPath(); + if(!al_string_empty(ppath)) + { + al_string_append_cstr(&ppath, "\\alsoft.ini"); + TRACE("Loading config %s...\n", al_string_get_cstr(ppath)); + f = al_fopen(al_string_get_cstr(ppath), "r"); + if(f) + { + LoadConfigFromFile(f); + fclose(f); + } + } + if((str=_wgetenv(L"ALSOFT_CONF")) != NULL && *str) { al_string filepath = AL_STRING_INIT_STATIC(); @@ -345,12 +359,15 @@ void ReadALConfig(void) } al_string_deinit(&filepath); } + + al_string_deinit(&ppath); } #else void ReadALConfig(void) { char buffer[PATH_MAX]; const char *str; + al_string ppath; FILE *f; str = "/etc/openal/alsoft.conf"; @@ -430,6 +447,19 @@ void ReadALConfig(void) } } + ppath = GetProcPath(); + if(!al_string_empty(ppath)) + { + al_string_append_cstr(&ppath, "/alsoft.conf"); + TRACE("Loading config %s...\n", al_string_get_cstr(ppath)); + f = al_fopen(al_string_get_cstr(ppath), "r"); + if(f) + { + LoadConfigFromFile(f); + fclose(f); + } + } + if((str=getenv("ALSOFT_CONF")) != NULL && *str) { TRACE("Loading config %s...\n", str); @@ -440,6 +470,8 @@ void ReadALConfig(void) fclose(f); } } + + al_string_deinit(&ppath); } #endif |