From c5fef4023871cc2d9f97fb45aa9ba161ded94bd3 Mon Sep 17 00:00:00 2001 From: Harald Sitter Date: Tue, 4 May 2021 08:11:27 +0200 Subject: [PATCH] unbreak XDG_CONFIG_DIRS and by extension autostart "If $XDG_CONFIG_DIRS is either not set or empty, a value equal to /etc/xdg should be used." If XDG_CONFIG_DIRS was not set prior to startplasma, which it ordinarily would not be, then the previous code would set the value to "$newdir:" which was silly and also wrong as per the spec quoted above. Instead default to /etc/xdg/. Also camelCase the variables to follow our coding style. --- startkde/startplasma.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/startkde/startplasma.cpp b/startkde/startplasma.cpp index 22491952a..dad8d96ee 100644 --- a/startkde/startplasma.cpp +++ b/startkde/startplasma.cpp @@ -330,9 +330,12 @@ void setupPlasmaEnvironment() qputenv("KDE_APPLICATIONS_AS_SCOPE", "1"); // Add kdedefaults dir to allow config defaults overriding from a writable location - const auto current_xdg_config_dirs = qgetenv("XDG_CONFIG_DIRS"); - const auto new_xdg_dir = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation).toUtf8() + "/kdedefaults"; - qputenv("XDG_CONFIG_DIRS", new_xdg_dir + ":" + current_xdg_config_dirs); + QByteArray currentConfigDirs = qgetenv("XDG_CONFIG_DIRS"); + if (currentConfigDirs.isEmpty()) { + currentConfigDirs = "/etc/xdg"; + } + const auto extraConfigDir = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation).toUtf8() + "/kdedefaults"; + qputenv("XDG_CONFIG_DIRS", extraConfigDir + ":" + currentConfigDirs); } void setupX11()