diff --git a/startkde/startplasma.cpp b/startkde/startplasma.cpp --- a/startkde/startplasma.cpp +++ b/startkde/startplasma.cpp @@ -185,28 +185,18 @@ } sourceFiles(scripts); - // If the kde installation is in a non-standard location (ie. with a dev build), - // it is possible the data root is not in the XDG_DATA_DIRS variable yet. - // If that's the case prepend it to the value. Prepending ensures this kde - // installation's resources will get preference over another one whose prefix - // is also in the XDG_DATA_DIRS variable, like a system installation in - // /usr/share. - // - // If our data root is already in the XDG_DATA_DIRS variable do nothing. This - // includes leaving it unset if it was unset. By doing nothing in this case - // we don't mess with the preference order implied by the value. + // To ensure the proper resources are available, the data root dir + // needs to be available in the XDG_DATA_DIRS variable, with + // the right preference. QString xdgDataDirsValue; if (qEnvironmentVariableIsSet("XDG_DATA_DIRS")) { xdgDataDirsValue = QString::fromLocal8Bit(qgetenv("XDG_DATA_DIRS")); } else { - // If the environment variable is unset, the spec says to assume - // this value. Set it here, so we can still perform the regular - // check on the value even though the value was unset. xdgDataDirsValue = QLatin1String("/usr/local/share:/usr/share"); } - QString kdeInstallFullDataRootDir = QStringLiteral(KDE_INSTALL_FULL_DATAROOTDIR); - QStringList xdgDataDirs = xdgDataDirsValue.split(QLatin1Char(':')); - if (!xdgDataDirs.contains(kdeInstallFullDataRootDir)) { + const QString kdeInstallFullDataRootDir = QStringLiteral(KDE_INSTALL_FULL_DATAROOTDIR); + QVector xdgDataDirs = xdgDataDirsValue.splitRef(QLatin1Char(':')); + if (!xdgDataDirs.contains(QStringRef(&kdeInstallFullDataRootDir))) { QString xdgDataDirsNewValue = kdeInstallFullDataRootDir + QLatin1Char(':') + xdgDataDirsValue; qputenv("XDG_DATA_DIRS", xdgDataDirsNewValue.toLocal8Bit()); }