diff --git a/daemon/src/managerimpl.cpp b/daemon/src/managerimpl.cpp
index 7d98db590a4c6da63319d28ef0586aa96273e82f..3fea3962993982df2f4f224ecd6f3d493fe858c4 100644
--- a/daemon/src/managerimpl.cpp
+++ b/daemon/src/managerimpl.cpp
@@ -1829,10 +1829,9 @@ std::string ManagerImpl::createConfigFile() const
     std::string configdir = std::string(HOMEDIR) + DIR_SEPARATOR_STR +
                             ".config" + DIR_SEPARATOR_STR + PACKAGE;
 
-    std::string xdg_env(XDG_CONFIG_HOME);
-    if (not xdg_env.empty()) {
-        configdir = xdg_env;
-    }
+    const std::string xdg_env(XDG_CONFIG_HOME);
+    if (not xdg_env.empty())
+        configdir = xdg_env + DIR_SEPARATOR_STR + PACKAGE;
 
     if (mkdir(configdir.data(), 0700) != 0) {
         // If directory creation failed