From 92314b65e9d633bfedb2b78ffa54f96799309112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 7 Oct 2017 16:21:35 +0200 Subject: [PATCH] GUI: Set PYTHONPATH --- gui/checkthread.cpp | 5 +++++ gui/mainwindow.cpp | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) mode change 100644 => 100755 gui/checkthread.cpp diff --git a/gui/checkthread.cpp b/gui/checkthread.cpp old mode 100644 new mode 100755 index 1ee28f2ac..671e068ae --- a/gui/checkthread.cpp +++ b/gui/checkthread.cpp @@ -296,6 +296,11 @@ void CheckThread::runAddonsAndTools(const QString &addonPath, const ImportProjec qDebug() << python << args; QProcess process; + QProcessEnvironment env = process.processEnvironment(); + if (!env.contains("PYTHONHOME") && !mPythonPath.isEmpty()) { + env.insert("PYTHONHOME", QFileInfo(mPythonPath).canonicalPath()); + process.setProcessEnvironment(env); + } process.start(python, args); process.waitForFinished(); const QString errout(process.readAllStandardError()); diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index c394d6258..5d7a5f127 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -49,7 +49,8 @@ static const QString OnlineHelpURL("http://cppcheck.net/manual.html"); static const QString compile_commands_json("compile_commands.json"); -static QString getDataDir(const QSettings *settings) { +static QString getDataDir(const QSettings *settings) +{ const QString dataDir = settings->value("DATADIR", QString()).toString(); const QString appPath = QFileInfo(QCoreApplication::applicationFilePath()).canonicalPath(); return dataDir.isEmpty() ? appPath : dataDir;