[Psi-devel] Bug-Report: Psi 0.10 stats every file in my home
Georg Sauthoff
g_sauthoff at web.de
Sat Mar 31 06:00:02 PDT 2007
Hi,
psi 0.10 stat()s every file at the top level of my home. This is a
problem because:
1) it is 'stupid'
2) I have a lot of files
3) I have symlinks to inactive nfs shares, thus in the worst case psi
hangs at startup
This is because of the language search code in main.cpp
PsiMain::PsiMain() - psi searches at the top level of my home for
language packs - WTF?!?
I report it here, because I was too afraid to open a new ticket in the
bug tracker and I reported it yesterday at the
psi-irc-channel-emulation, but noone cared.
The following patch fixes psi for me:
--- a/src/main.cpp Fri Mar 30 20:01:25 2007 +0200
+++ b/src/main.cpp Fri Mar 30 20:01:38 2007 +0200
@@ -113,52 +113,8 @@ PsiMain::PsiMain(QObject *par)
{
pcon = 0;
- // detect available language packs
langs.set("en", "English");
- QStringList dirs;
- QString subdir = "";
- dirs += "." + subdir;
- dirs += g.pathHome + subdir;
- dirs += g.pathBase + subdir;
-
- for(QStringList::Iterator it = dirs.begin(); it != dirs.end(); ++it) {
- if(!QFile::exists(*it))
- continue;
- QDir d(*it);
- QStringList entries = d.entryList();
- for(QStringList::Iterator it2 = entries.begin(); it2 != entries.end(); ++it2) {
- if(*it2 == "." || *it2 == "..")
- continue;
-
- QString str = *it2;
- // verify that it is a language file
- if(str.left(4) != "psi_")
- continue;
- int n = str.find('.', 4);
- if(n == -1)
- continue;
- if(str.mid(n) != ".qm")
- continue;
- QString lang = str.mid(4, n-4);
-
- //printf("found [%s], lang=[%s]\n", str.latin1(), lang.latin1());
-
- // get the language_name
- QString name = QString("[") + str + "]";
- QTranslator t(0);
- if(!t.load(str, *it))
- continue;
-
- if(t.contains("@default", "language_name", 0)) {
- QString s = t.findMessage("@default", "language_name", 0).translation();
- if(!s.isEmpty())
- name = s;
- }
-
- langs.set(lang, name);
- }
- }
Best regards
Georg Sauthoff
More information about the psi-devel
mailing list