[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    kstandarddirs
From:       Sune Vuorela <debian () pusling ! com>
Date:       2008-05-29 20:47:39
Message-ID: 200805292247.56779.debian () pusling ! com
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


Hi1

kstanddarddirs seems to be looking in the following places for <stuff>

users homedir, CMAKE_INSTALL_PREFIX/$suffix, SPECIFIC_INSTALL_DIR. 
with $suffix, for example being share/apps - and SPECIFIC_INSTALL_DIR for 
example being DATA_INSTALL_DIR.

And that is the current priority order.

If CMAKE_INSTALL_PREFIX is set to /usr and DATA_INSTALL_DIR is set to 
/usr/share/kde4, we have the following situation:

apps looks for data first in users homedir, then in /usr/share/apps and then 
finally in /usr/share/kde4/apps  until it finds something that *looks* like 
what the app needs.  If a similar kde3 app (or lib) has its data in 
/usr/share/apps, the kde3 version is currently being preferred by kde4 apps.
(debian and fedora is at least hit by this)

I have tried to patch kstandarddirs in a way that makes the following 
priorities:
users home
installdir
prefix/path

which fixes it.

I don't fully know if my patch have any unwanted side effects though.

Comments welcome. If no comments within next week, I think I will be 
brave/stupid and just go ahead and commit.

And thanks to Matthias Kretz for pointing me in the right direction.

/Sune
-- 
Man, how to insert the kernel of a display?

First you cannot ping to the coaxial BIOS for disabling the case on the folder 
to the proxy.


["kstandarddirs.diff" (text/x-patch)]

Index: b/kdecore/kernel/kstandarddirs.cpp
===================================================================
--- a/kdecore/kernel/kstandarddirs.cpp
+++ b/kdecore/kernel/kstandarddirs.cpp
@@ -77,9 +77,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;
@@ -954,10 +957,59 @@
                 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
+        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;
@@ -983,13 +1035,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();
@@ -1011,19 +1056,6 @@
             }
         }
 
-        // make sure we find the path where it's installed
-        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);
-        }
 
         dirs = d->absolutes.value(type);
         if (!dirs.isEmpty())
@@ -1487,6 +1519,7 @@
     {
         localKdeDir = KShell::tildeExpand(localKdeDir);
         addPrefix(localKdeDir);
+        d->localKdehome=localKdeDir;
     }
 
 #ifdef Q_WS_MACX
@@ -1545,6 +1578,7 @@
 
     localXdgDir = KShell::tildeExpand(localXdgDir);
     addXdgConfigPrefix(localXdgDir);
+    d->localXdgconfhome=localXdgDir;
 
     for (QStringList::ConstIterator it = xdgdirList.begin();
          it != xdgdirList.end(); ++it)
@@ -1593,6 +1627,7 @@
 
     localXdgDir = KShell::tildeExpand(localXdgDir);
     addXdgDataPrefix(localXdgDir);
+    d->localXdgdatahome=localXdgDir;
 
     for (QStringList::ConstIterator it = xdgdirList.begin();
          it != xdgdirList.end(); ++it)

["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic