handle XDG_CONFIG_DIRS as list of paths in QStandardPaths::standardLocations()

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2021-11-21 16:57:02 +02:00
parent d0bc84533a
commit c384b2c1c8

View file

@ -192,9 +192,9 @@ QStringList QStandardPaths::standardLocations(StandardLocation type)
}
case StandardLocation::DataLocation: {
const QString xdghome(getEnvName("XDG_DATA_HOME"));
if (!xdghome.isEmpty()) {
result.append(xdghome);
const QString location(getEnvName("XDG_DATA_HOME"));
if (!location.isEmpty()) {
result.append(location);
} else {
result.append(QDir::homePath() + QLatin1String("/.local/share"));
}
@ -217,16 +217,16 @@ QStringList QStandardPaths::standardLocations(StandardLocation type)
break;
}
case StandardLocation::ConfigLocation: {
const QString xdghome(getEnvName("XDG_CONFIG_HOME"));
if (!xdghome.isEmpty()) {
result.append(xdghome);
const QString location(getEnvName("XDG_CONFIG_HOME"));
if (!location.isEmpty()) {
result.append(location);
} else {
result.append(QDir::homePath() + QLatin1String("/.config"));
}
const QString location(getEnvName("XDG_CONFIG_DIRS"));
if (!location.isEmpty()) {
result.append(location);
const QStringList locations(getEnvListName("XDG_CONFIG_DIRS"));
if (!locations.isEmpty()) {
result.append(locations);
} else {
result.append(QDir::homePath() + QLatin1String("/etc/xdg"));
}