davidedmundson added a comment.
Concept makes sense. QStandardPaths is ordered: "The list of directories is sorted from high to low priority, starting with writableLocation()" so we can cut this code in half by doing some sort of void runEnvironmentScripts() { const auto locations = QStandardPaths::.... locations.reverse(); for (const QString &location:locations) { runScriptsInDir(location) } } void runScriptsInDir(const QString &dir) { QDir dir(location); ... std::sort( ... } which will keep addition XDG_CONFIG_DIRS in the right order too REPOSITORY R120 Plasma Workspace REVISION DETAIL https://phabricator.kde.org/D28941 To: auxym, #plasma, davidedmundson Cc: plasma-devel, Orage, LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, ragreen, ZrenBot, ngraham, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, ahiemstra, mart