diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index affc05186..165f44eec 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -657,6 +657,19 @@ Library::Error MainWindow::LoadLibrary(Library *library, QString filename) if (ret.errorcode != Library::ErrorCode::FILE_NOT_FOUND) return ret; +#ifdef CFGDIR + // Try to load the library from CFGDIR.. + const QString cfgdir = CFGDIR; + if (!cfgdir.isEmpty()) { + ret = library->load(NULL, (cfgdir+"/"+filename).toLatin1()); + if (ret.errorcode != Library::ErrorCode::FILE_NOT_FOUND) + return ret; + ret = library->load(NULL, (cfgdir+"/cfg/"+filename).toLatin1()); + if (ret.errorcode != Library::ErrorCode::FILE_NOT_FOUND) + return ret; + } +#endif + // Try to load the library from the cfg subfolder.. const QString datadir = mSettings->value("DATADIR", QString()).toString(); if (!datadir.isEmpty()) { diff --git a/gui/projectfiledialog.cpp b/gui/projectfiledialog.cpp index b0ef5f637..1fc0531ae 100644 --- a/gui/projectfiledialog.cpp +++ b/gui/projectfiledialog.cpp @@ -48,9 +48,16 @@ ProjectFileDialog::ProjectFileDialog(const QString &path, QWidget *parent) const QString applicationFilePath = QCoreApplication::applicationFilePath(); const QString appPath = QFileInfo(applicationFilePath).canonicalPath(); QSettings settings; +#ifdef CFGDIR + const QString cfgdir = CFGDIR; +#endif const QString datadir = settings.value("DATADIR",QString()).toString(); QStringList searchPaths; searchPaths << appPath << appPath + "/cfg" << inf.canonicalPath(); +#ifdef CFGDIR + if (!cfgdir.isEmpty()) + searchPaths << cfgdir << cfgdir + "/cfg"; +#endif if (!datadir.isEmpty()) searchPaths << datadir << datadir + "/cfg"; QStringList libs;