From kde-core-devel Wed Aug 29 19:44:48 2007 From: Pascal =?iso-8859-1?q?L=E9tourneau?= Date: Wed, 29 Aug 2007 19:44:48 +0000 To: kde-core-devel Subject: Re: Duplicate entries in ksycoca4 Message-Id: <200708291544.48251.pascal.letourneau () gmail ! com> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=118841715206064 On Saturday 25 August 2007 00:00:49 Allen Winter wrote: >On Wednesday 15 August 2007 3:05:11 pm Pascal Létourneau wrote: >> Hi >> >> On my system, KStandardDirs::resourceDirs("applications") returns (among >> others) >> /home/pletourn/kde/share/applications >> coming from "KDEDIR" + "share/" + "applications" >> /home/pletourn/kde/share/applications/kde4 >> coming from "XDG_APPS_INSTALL_DIR" >> which cause duplicate apps entries in ksycoca4 >> >> With the included patch, installdir is no longer returned when it starts with >> one of the previous canditates >> >> Is that an acceptable solution? > > >I wonder if this is why we have double and triple menu entries?? Yes Pascal Létourneau Index: kstandarddirs.cpp =================================================================== --- kstandarddirs.cpp (revision 706139) +++ kstandarddirs.cpp (working copy) @@ -1117,8 +1117,17 @@ QStringList KStandardDirs::resourceDirs( // make sure we find the path where it's installed QString installdir = installPath( type ); - if (!installdir.isEmpty() && !candidates.contains(installdir)) + if (!installdir.isEmpty()) { + bool ok = true; + foreach (QString s, candidates) { + if (installdir.startsWith(s)) { + ok = false; + break; + } + } + if (ok) candidates.append(installdir); + } dirs = d->absolutes.value(type); if (!dirs.isEmpty())