kdelibs/kdelibs-4.0.4-kstandarddirs.patch
Than Ngo 88c09b10fc - fix #447965, order issue in kde path, thanks to Kevin
- backport patch to check html style version
2008-05-30 17:05:09 +00:00

158 lines
5.3 KiB
Diff

diff -ur kdelibs-4.0.4/kdecore/kernel/kstandarddirs.cpp kdelibs-4.0.4-kstandarddirs/kdecore/kernel/kstandarddirs.cpp
--- kdelibs-4.0.4/kdecore/kernel/kstandarddirs.cpp 2008-05-01 12:16:52.000000000 +0200
+++ kdelibs-4.0.4-kstandarddirs/kdecore/kernel/kstandarddirs.cpp 2008-05-30 18:01:45.000000000 +0200
@@ -72,9 +72,12 @@
bool checkRestrictions : 1;
QMap<QByteArray, bool> restrictions;
QStringList xdgdata_prefixes;
+ QString localXdgdatahome;
QStringList xdgconf_prefixes;
+ QString localXdgconfhome;
QStringList prefixes;
+ QString localKdehome;
// Directory dictionaries
QMap<QByteArray, QStringList> absolutes;
@@ -945,10 +948,62 @@
restrictionActive = true;
d->dataRestrictionActive = false; // Reset
}
+ const QStringList *prefixList = 0;
+ QString home;
+ if (strncmp(type, "xdgdata-", 8) == 0)
+ {
+ prefixList = &(d->xdgdata_prefixes);
+ home=d->localXdgdatahome;
+ }
+ else if (strncmp(type, "xdgconf-", 8) == 0)
+ {
+ prefixList = &(d->xdgconf_prefixes);
+ home=d->localXdgconfhome;
+ }
+ else
+ {
+ prefixList = &d->prefixes;
+ home=d->localKdehome;
+ }
QStringList dirs;
dirs = d->relatives.value(type);
+ if(!home.isNull())
+ {
+ for (QStringList::ConstIterator it = dirs.begin();
+ it != dirs.end(); ++it)
+ {
+ if ( (*it).startsWith('%'))
+ continue;
+ QString path = realPath( home + *it );
+ testdir.setPath(path);
+ if (restrictionActive)
+ continue;
+ if (!candidates.contains(path))
+ candidates.append(path);
+ }
+
+ }
+
+ // make sure we find the path where it's installed
+ // for non-config files, we want the installed path _first_, so /usr/share/kde4 takes precedence over /usr/share
+ if (strcmp("config", type)) {
+ QString installdir = installPath( type );
+ if (!installdir.isEmpty()) {
+ bool ok = true;
+ foreach (const QString &s, candidates) {
+ if (installdir.startsWith(s)) {
+ ok = false;
+ break;
+ }
+ }
+ if (ok) {
+ candidates.append(installdir);
+ }
+ }
+ }
+
if (!dirs.isEmpty())
{
bool local = true;
@@ -974,13 +1029,6 @@
}
}
- const QStringList *prefixList = 0;
- if (strncmp(type, "xdgdata-", 8) == 0)
- prefixList = &(d->xdgdata_prefixes);
- else if (strncmp(type, "xdgconf-", 8) == 0)
- prefixList = &(d->xdgconf_prefixes);
- else
- prefixList = &d->prefixes;
for (QStringList::ConstIterator pit = prefixList->begin();
pit != prefixList->end();
@@ -998,22 +1046,30 @@
if ((local || testdir.exists()) && !candidates.contains(path))
candidates.append(path);
}
+ // UGLY HACK - forward porting Chris CHeney's HACK - Rex Dieter
+ if ( local && (!strcmp("config", type)))
+ candidates.append("/etc/kde/");
+ //
local = false;
}
}
// make sure we find the path where it's installed
- QString installdir = installPath( type );
- if (!installdir.isEmpty()) {
- bool ok = true;
- foreach (QString s, candidates) {
- if (installdir.startsWith(s)) {
- ok = false;
- break;
+ // for config files, we want the installed path _last_, so profiles take precedence
+ if (!strcmp("config", type)) {
+ QString installdir = installPath( type );
+ if (!installdir.isEmpty()) {
+ bool ok = true;
+ foreach (const QString &s, candidates) {
+ if (installdir.startsWith(s)) {
+ ok = false;
+ break;
+ }
+ }
+ if (ok) {
+ candidates.append(installdir);
}
}
- if (ok)
- candidates.append(installdir);
}
dirs = d->absolutes.value(type);
@@ -1478,6 +1534,7 @@
{
localKdeDir = KShell::tildeExpand(localKdeDir);
addPrefix(localKdeDir);
+ d->localKdehome=localKdeDir;
}
QStringList::ConstIterator end(kdedirList.end());
@@ -1524,6 +1581,7 @@
localXdgDir = KShell::tildeExpand(localXdgDir);
addXdgConfigPrefix(localXdgDir);
+ d->localXdgconfhome=localXdgDir;
for (QStringList::ConstIterator it = xdgdirList.begin();
it != xdgdirList.end(); ++it)
@@ -1568,6 +1626,7 @@
localXdgDir = KShell::tildeExpand(localXdgDir);
addXdgDataPrefix(localXdgDir);
+ d->localXdgdatahome=localXdgDir;
for (QStringList::ConstIterator it = xdgdirList.begin();
it != xdgdirList.end(); ++it)