diff --git a/gui/checkthread.cpp b/gui/checkthread.cpp index bc6f117e0..5e793435a 100644 --- a/gui/checkthread.cpp +++ b/gui/checkthread.cpp @@ -72,15 +72,7 @@ void CheckThread::run() return; } - QString addonPath; - if (QFileInfo(mDataDir + "/threadsafety.py").exists()) - addonPath = mDataDir; - else if (QDir(mDataDir + "/addons").exists()) - addonPath = mDataDir + "/addons"; - else if (mDataDir.endsWith("/cfg")) { - if (QDir(mDataDir.mid(0,mDataDir.size()-3) + "addons").exists()) - addonPath = mDataDir.mid(0,mDataDir.size()-3) + "addons"; - } + QString addonPath = getAddonPath(); bool needDump = mAddons.contains("y2038") || mAddons.contains("threadsafety") || mAddons.contains("cert") || mAddons.contains("misra"); QString file = mResult.getNextFile(); @@ -182,6 +174,18 @@ void CheckThread::stop() mCppcheck.terminate(); } +QString CheckThread::getAddonPath() const { + if (QFileInfo(mDataDir + "/threadsafety.py").exists()) + return mDataDir; + else if (QDir(mDataDir + "/addons").exists()) + return mDataDir + "/addons"; + else if (mDataDir.endsWith("/cfg")) { + if (QDir(mDataDir.mid(0,mDataDir.size()-3) + "addons").exists()) + return mDataDir.mid(0,mDataDir.size()-3) + "addons"; + } + return QString(); +} + void CheckThread::parseAddonErrors(QString err, QString tool) { QTextStream in(&err, QIODevice::ReadOnly); diff --git a/gui/checkthread.h b/gui/checkthread.h index 89a86ad66..aaaf1e5fc 100644 --- a/gui/checkthread.h +++ b/gui/checkthread.h @@ -106,6 +106,8 @@ protected: CppCheck mCppcheck; private: + QString getAddonPath() const; + void parseAddonErrors(QString err, QString tool); void parseClangErrors(QString err);