summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-12-06 12:03:12 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-12-06 12:03:12 -0800
commite015effb475af12d4c6627b9c3d1f9be215f6b2b (patch)
tree38e13a39600ab0fac44c13b75f326406692f3215
parent9b7b477d7cc868212045a78b30089363cbebcf91 (diff)
downloadsubsurface-e015effb475af12d4c6627b9c3d1f9be215f6b2b.tar.gz
Don't change working directory when looking for tranlations
And only replace 'bin' if there is a bin in the path... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-gui.cpp9
-rw-r--r--qt-ui/models.cpp2
2 files changed, 7 insertions, 4 deletions
diff --git a/qt-gui.cpp b/qt-gui.cpp
index 04c5bc17a..0b80bb557 100644
--- a/qt-gui.cpp
+++ b/qt-gui.cpp
@@ -403,10 +403,11 @@ QString getSubsurfaceDataPath(QString folderToFind)
// next check for the Linux typical $(prefix)/share/subsurface
execdir = QCoreApplication::applicationDirPath();
- folder = QDir(execdir.replace("bin", "share/subsurface/").append(folderToFind));
- if (folder.exists())
- return folder.absolutePath();
-
+ if (execdir.contains("bin")) {
+ folder = QDir(execdir.replace("bin", "share/subsurface/").append(folderToFind));
+ if (folder.exists())
+ return folder.absolutePath();
+ }
// then look for the usual location on a Mac
execdir = QCoreApplication::applicationDirPath();
folder = QDir(execdir.append("/../Resources/share/").append(folderToFind));
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index e57ececd4..2585c578f 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -1766,6 +1766,7 @@ LanguageModel::LanguageModel(QObject* parent): QAbstractListModel(parent)
{
QSettings s;
QDir d;
+ QString cwd = d.currentPath();
d.setCurrent( getSubsurfaceDataPath("translations") );
QStringList result = d.entryList();
Q_FOREACH(const QString& s, result){
@@ -1774,6 +1775,7 @@ LanguageModel::LanguageModel(QObject* parent): QAbstractListModel(parent)
}
languages.push_back( (s == "subsurface_source.qm") ? "English" : s);
}
+ d.setCurrent(cwd);
}
QVariant LanguageModel::data(const QModelIndex& index, int role) const