5454static const QString OnlineHelpURL (" http://cppcheck.net/manual.html" );
5555static const QString compile_commands_json (" compile_commands.json" );
5656
57- static QString getDataDir (const QSettings *settings)
58- {
59- const QString dataDir = settings->value (" DATADIR" , QString ()).toString ();
60- const QString appPath = QFileInfo (QCoreApplication::applicationFilePath ()).canonicalPath ();
61- return dataDir.isEmpty () ? appPath : dataDir;
62- }
63-
6457MainWindow::MainWindow (TranslationHandler* th, QSettings* settings) :
6558 mSettings(settings),
6659 mApplications(new ApplicationList(this )),
@@ -76,7 +69,7 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) :
7669{
7770 mUI .setupUi (this );
7871 mThread = new ThreadHandler (this );
79- mThread ->setDataDir (getDataDir (settings ));
72+ mThread ->setDataDir (getDataDir ());
8073 mUI .mResults ->initialize (mSettings , mApplications , mThread );
8174
8275 // Filter timer to delay filtering results slightly while typing
@@ -786,7 +779,7 @@ Library::Error MainWindow::loadLibrary(Library *library, const QString &filename
786779#endif
787780
788781 // Try to load the library from the cfg subfolder..
789- const QString datadir = mSettings -> value ( " DATADIR " , QString ()). toString ();
782+ const QString datadir = getDataDir ();
790783 if (!datadir.isEmpty ()) {
791784 ret = library->load (nullptr , (datadir+" /" +filename).toLatin1 ());
792785 if (ret.errorcode != Library::ErrorCode::FILE_NOT_FOUND)
@@ -943,7 +936,7 @@ Settings MainWindow::getCppcheckSettings()
943936 foreach (QString s, mProjectFile ->getCheckUnknownFunctionReturn ())
944937 result.checkUnknownFunctionReturn .insert (s.toStdString ());
945938
946- QString filesDir (getDataDir (mSettings ));
939+ QString filesDir (getDataDir ());
947940 const QString pythonCmd = mSettings ->value (SETTINGS_PYTHON_PATH).toString ();
948941 foreach (QString addon, mProjectFile ->getAddons ()) {
949942 QString addonFilePath = ProjectFile::getAddonFilePath (filesDir, addon);
0 commit comments