From 33a9def78724bc9caf807a226d42428c1478cc63 Mon Sep 17 00:00:00 2001 From: Colin Kinloch Date: Mon, 11 Sep 2023 23:37:36 +0100 Subject: [PATCH] config: Use XDG_CONFIG_HOME --- src/engine/configEngine.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/engine/configEngine.cpp b/src/engine/configEngine.cpp index f793d35c2..123a19a81 100644 --- a/src/engine/configEngine.cpp +++ b/src/engine/configEngine.cpp @@ -61,9 +61,11 @@ void DivEngine::initConfDir() { return; } #else - // TODO this should check XDG_CONFIG_HOME first + char* xdgConfigHome=getenv("XDG_CONFIG_HOME"); char* home=getenv("HOME"); - if (home==NULL) { + if (xdgConfigHome) { + configPath=xdgConfigHome; + } else if (home==NULL) { int uid=getuid(); struct passwd* entry=getpwuid(uid); if (entry==NULL) { @@ -79,8 +81,9 @@ void DivEngine::initConfDir() { #ifdef __APPLE__ configPath+="/Library/Application Support"; #else - // FIXME this doesn't honour XDG_CONFIG_HOME *at all* - configPath+="/.config"; + if (xdgConfigHome==NULL) { + configPath+="/.config"; + } #endif // __APPLE__ #endif // __HAIKU__ #ifdef __APPLE__