[client] config: load config file based on new lgConfigDir()

This commit is contained in:
Quantum 2021-07-31 07:05:48 -04:00 committed by Geoffrey McRae
parent 3369536cb8
commit 6109067275
2 changed files with 4 additions and 8 deletions

View File

@ -24,6 +24,7 @@
#include "common/option.h" #include "common/option.h"
#include "common/debug.h" #include "common/debug.h"
#include "common/paths.h"
#include "common/stringutils.h" #include "common/stringutils.h"
#include <sys/stat.h> #include <sys/stat.h>
@ -497,14 +498,7 @@ bool config_load(int argc, char * argv[])
// load config from XDG_CONFIG_HOME // load config from XDG_CONFIG_HOME
char * xdgFile; char * xdgFile;
char * dir; alloc_sprintf(&xdgFile, "%s/client.ini", lgConfigDir());
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);
if (xdgFile && stat(xdgFile, &st) >= 0 && S_ISREG(st.st_mode)) if (xdgFile && stat(xdgFile, &st) >= 0 && S_ISREG(st.st_mode))
{ {

View File

@ -48,6 +48,7 @@
#include "common/ivshmem.h" #include "common/ivshmem.h"
#include "common/time.h" #include "common/time.h"
#include "common/version.h" #include "common/version.h"
#include "common/paths.h"
#include "core.h" #include "core.h"
#include "app.h" #include "app.h"
@ -1235,6 +1236,7 @@ int main(int argc, char * argv[])
if (!installCrashHandler("/proc/self/exe")) if (!installCrashHandler("/proc/self/exe"))
DEBUG_WARN("Failed to install the crash handler"); DEBUG_WARN("Failed to install the crash handler");
lgPathsInit("looking-glass");
config_init(); config_init();
ivshmemOptionsInit(); ivshmemOptionsInit();
egl_dynProcsInit(); egl_dynProcsInit();