2008-05-30 17:05:09 +00:00
|
|
|
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
|
2008-06-27 01:49:42 +00:00
|
|
|
+ // for non-config, non-exe files, we want the installed path _first_, so /usr/share/kde4 takes precedence over /usr/share
|
|
|
|
+ if (strcmp("config", type) && strcmp("exe", type)) {
|
2008-05-30 17:05:09 +00:00
|
|
|
+ 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 @@
|
2008-05-22 18:43:42 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2008-05-30 17:05:09 +00:00
|
|
|
|
2008-06-27 01:49:42 +00:00
|
|
|
- // make sure we find the path where it's installed
|
2008-05-30 17:05:09 +00:00
|
|
|
- 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
|
2008-06-27 01:49:42 +00:00
|
|
|
+ // for exe files too, so /usr/libexec/kde4 takes precedence over /usr/bin
|
|
|
|
+ if (!strcmp("config", type) || !strcmp("exe", type)) {
|
2008-05-30 17:05:09 +00:00
|
|
|
+ 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)
|