From 61090672753232929777d12c08d9fa777d17b0c6 Mon Sep 17 00:00:00 2001 From: Quantum Date: Sat, 31 Jul 2021 07:05:48 -0400 Subject: [PATCH] [client] config: load config file based on new lgConfigDir() --- client/src/config.c | 10 ++-------- client/src/main.c | 2 ++ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/client/src/config.c b/client/src/config.c index e94a5914..a0a526ec 100644 --- a/client/src/config.c +++ b/client/src/config.c @@ -24,6 +24,7 @@ #include "common/option.h" #include "common/debug.h" +#include "common/paths.h" #include "common/stringutils.h" #include @@ -497,14 +498,7 @@ bool config_load(int argc, char * argv[]) // load config from XDG_CONFIG_HOME char * xdgFile; - char * dir; - - if ((dir = getenv("XDG_CONFIG_HOME")) != NULL) - alloc_sprintf(&xdgFile, "%s/looking-glass/client.ini", dir); - else if ((dir = getenv("HOME")) != NULL) - alloc_sprintf(&xdgFile, "%s/.config/looking-glass/client.ini", dir); - else - alloc_sprintf(&xdgFile, "%s/.config/looking-glass/client.ini", pw->pw_dir); + alloc_sprintf(&xdgFile, "%s/client.ini", lgConfigDir()); if (xdgFile && stat(xdgFile, &st) >= 0 && S_ISREG(st.st_mode)) { diff --git a/client/src/main.c b/client/src/main.c index 47ac90b0..4af4b85c 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -48,6 +48,7 @@ #include "common/ivshmem.h" #include "common/time.h" #include "common/version.h" +#include "common/paths.h" #include "core.h" #include "app.h" @@ -1235,6 +1236,7 @@ int main(int argc, char * argv[]) if (!installCrashHandler("/proc/self/exe")) DEBUG_WARN("Failed to install the crash handler"); + lgPathsInit("looking-glass"); config_init(); ivshmemOptionsInit(); egl_dynProcsInit();