2929#include < QtCore/QDir>
3030#include < QtCore/QLibrary>
3131
32+ #include " ConfigManager.h"
33+
3234#ifdef LMMS_BUILD_WIN32
3335 QStringList nameFilters (" *.dll" );
3436#else
@@ -39,7 +41,7 @@ PluginFactory* PluginFactory::s_instance = nullptr;
3941
4042PluginFactory::PluginFactory ()
4143{
42- // Adds a search path relative to the main executable to if the path exists.
44+ // Adds a search path relative to the main executable if the path exists.
4345 auto addRelativeIfExists = [this ] (const QString& path) {
4446 QDir dir (qApp->applicationDirPath ());
4547 if (!path.isEmpty () && dir.cd (path)) {
@@ -68,6 +70,8 @@ PluginFactory::PluginFactory()
6870 if (!(env_path = qgetenv (" LMMS_PLUGIN_DIR" )).isEmpty ())
6971 QDir::addSearchPath (" plugins" , env_path);
7072
73+ QDir::addSearchPath (" plugins" , ConfigManager::inst ()->workingDir () + " plugins" );
74+
7175 discoverPlugins ();
7276}
7377
@@ -127,7 +131,11 @@ void PluginFactory::discoverPlugins()
127131 PluginInfoList pluginInfos;
128132 m_pluginByExt.clear ();
129133
130- const QFileInfoList& files = QDir (" plugins:" ).entryInfoList (nameFilters);
134+ QFileInfoList files;
135+ for (const QString& searchPath : QDir::searchPaths (" plugins" ))
136+ {
137+ files << QDir (searchPath).entryInfoList (nameFilters);
138+ }
131139
132140 // Cheap dependency handling: zynaddsubfx needs ZynAddSubFxCore. By loading
133141 // all libraries twice we ensure that libZynAddSubFxCore is found.
@@ -142,6 +150,7 @@ void PluginFactory::discoverPlugins()
142150
143151 if (! library->load ()) {
144152 m_errors[file.baseName ()] = library->errorString ();
153+ qWarning (library->errorString ().toLocal8Bit ());
145154 continue ;
146155 }
147156 if (library->resolve (" lmms_plugin_main" ) == nullptr ) {
0 commit comments