mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
9b7b477d7c
commit
e015effb47
2 changed files with 7 additions and 4 deletions
|
@ -403,10 +403,11 @@ QString getSubsurfaceDataPath(QString folderToFind)
|
||||||
|
|
||||||
// next check for the Linux typical $(prefix)/share/subsurface
|
// next check for the Linux typical $(prefix)/share/subsurface
|
||||||
execdir = QCoreApplication::applicationDirPath();
|
execdir = QCoreApplication::applicationDirPath();
|
||||||
folder = QDir(execdir.replace("bin", "share/subsurface/").append(folderToFind));
|
if (execdir.contains("bin")) {
|
||||||
if (folder.exists())
|
folder = QDir(execdir.replace("bin", "share/subsurface/").append(folderToFind));
|
||||||
return folder.absolutePath();
|
if (folder.exists())
|
||||||
|
return folder.absolutePath();
|
||||||
|
}
|
||||||
// then look for the usual location on a Mac
|
// then look for the usual location on a Mac
|
||||||
execdir = QCoreApplication::applicationDirPath();
|
execdir = QCoreApplication::applicationDirPath();
|
||||||
folder = QDir(execdir.append("/../Resources/share/").append(folderToFind));
|
folder = QDir(execdir.append("/../Resources/share/").append(folderToFind));
|
||||||
|
|
|
@ -1766,6 +1766,7 @@ LanguageModel::LanguageModel(QObject* parent): QAbstractListModel(parent)
|
||||||
{
|
{
|
||||||
QSettings s;
|
QSettings s;
|
||||||
QDir d;
|
QDir d;
|
||||||
|
QString cwd = d.currentPath();
|
||||||
d.setCurrent( getSubsurfaceDataPath("translations") );
|
d.setCurrent( getSubsurfaceDataPath("translations") );
|
||||||
QStringList result = d.entryList();
|
QStringList result = d.entryList();
|
||||||
Q_FOREACH(const QString& s, result){
|
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);
|
languages.push_back( (s == "subsurface_source.qm") ? "English" : s);
|
||||||
}
|
}
|
||||||
|
d.setCurrent(cwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant LanguageModel::data(const QModelIndex& index, int role) const
|
QVariant LanguageModel::data(const QModelIndex& index, int role) const
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue