diff options
author | Chris Robinson <[email protected]> | 2018-11-11 16:09:24 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-11-11 16:09:24 -0800 |
commit | 4793e5c4ae3472b1f931ec48f913614710a6d12c (patch) | |
tree | e71270203ab9a2353b47e84a7d23eef9453375e9 /Alc/alconfig.cpp | |
parent | 58a71a1a00b2cbacd00679f9136233dae23a7ca7 (diff) |
Use C++ for GetProcBinary
Diffstat (limited to 'Alc/alconfig.cpp')
-rw-r--r-- | Alc/alconfig.cpp | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/Alc/alconfig.cpp b/Alc/alconfig.cpp index 29593205..fedb6703 100644 --- a/Alc/alconfig.cpp +++ b/Alc/alconfig.cpp @@ -299,13 +299,12 @@ void ReadALConfig(void) LoadConfigFromFile(f); } - al_string ppath = AL_STRING_INIT_STATIC(); - GetProcBinary(&ppath, nullptr); - if(!alstr_empty(ppath)) + PathNamePair ppath = GetProcBinary(); + if(!ppath.path.empty()) { - alstr_append_cstr(&ppath, "\\alsoft.ini"); - TRACE("Loading config %s...\n", alstr_get_cstr(ppath)); - al::ifstream f{alstr_get_cstr(ppath)}; + ppath.path += "\\alsoft.ini"; + TRACE("Loading config %s...\n", ppath.path.c_str()); + al::ifstream f{ppath.path.c_str()}; if(f.is_open()) LoadConfigFromFile(f); } @@ -320,8 +319,6 @@ void ReadALConfig(void) if(f.is_open()) LoadConfigFromFile(f); } - - alstr_reset(&ppath); } #else void ReadALConfig(void) @@ -425,15 +422,14 @@ void ReadALConfig(void) LoadConfigFromFile(f); } - al_string ppath = AL_STRING_INIT_STATIC(); - GetProcBinary(&ppath, nullptr); - if(!alstr_empty(ppath)) + PathNamePair ppath = GetProcBinary(); + if(!ppath.path.empty()) { - if(VECTOR_BACK(ppath) != '/') alstr_append_cstr(&ppath, "/alsoft.conf"); - else alstr_append_cstr(&ppath, "alsoft.conf"); + if(ppath.path.back() != '/') ppath.path += "/alsoft.conf"; + else ppath.path += "alsoft.conf"; - TRACE("Loading config %s...\n", alstr_get_cstr(ppath)); - al::ifstream f{alstr_get_cstr(ppath)}; + TRACE("Loading config %s...\n", ppath.path.c_str()); + al::ifstream f{ppath.path}; if(f.is_open()) LoadConfigFromFile(f); } @@ -445,8 +441,6 @@ void ReadALConfig(void) if(f.is_open()) LoadConfigFromFile(f); } - - alstr_reset(&ppath); } #endif |