Don't try to load translations from a directory that contains another directory called "clementine". Fixes issue #88

This commit is contained in:
David Sansome 2010-03-23 18:00:55 +00:00
parent f8dd079cfd
commit 4ab755c831
1 changed files with 10 additions and 2 deletions

View File

@ -23,9 +23,17 @@
#endif #endif
void LoadTranslation(const QString& prefix, const QString& path) { void LoadTranslation(const QString& prefix, const QString& path) {
// QTranslator::load will try to open and read "clementine" if it exists,
// without checking if it's a file first.
QFileInfo maybe_clementine_directory(path + "/clementine");
if (maybe_clementine_directory.exists() && !maybe_clementine_directory.isFile())
return;
QTranslator* t = new QTranslator; QTranslator* t = new QTranslator;
t->load(prefix + "_" + QLocale::system().name(), path); if (t->load(prefix + "_" + QLocale::system().name(), path))
QCoreApplication::installTranslator(t); QCoreApplication::installTranslator(t);
else
delete t;
} }
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {