Permalink
Browse files

PluginFactory: Fix LMMS_PLUGIN_DIR search path, add ~/lmms/plugins/

Fixes #3392, supersedes #3431
  • Loading branch information...
lukas-w committed Mar 21, 2017
1 parent f57202c commit 7251c84f1c22b9803de067cae2a1012d2112af26
Showing with 11 additions and 2 deletions.
  1. +11 −2 src/core/PluginFactory.cpp
View
@@ -29,6 +29,8 @@
#include <QtCore/QDir>
#include <QtCore/QLibrary>
+#include "ConfigManager.h"
+
#ifdef LMMS_BUILD_WIN32
QStringList nameFilters("*.dll");
#else
@@ -39,7 +41,7 @@ PluginFactory* PluginFactory::s_instance = nullptr;
PluginFactory::PluginFactory()
{
- // Adds a search path relative to the main executable to if the path exists.
+ // Adds a search path relative to the main executable if the path exists.
auto addRelativeIfExists = [this] (const QString& path) {
QDir dir(qApp->applicationDirPath());
if (!path.isEmpty() && dir.cd(path)) {
@@ -68,6 +70,8 @@ PluginFactory::PluginFactory()
if (!(env_path = qgetenv("LMMS_PLUGIN_DIR")).isEmpty())
QDir::addSearchPath("plugins", env_path);
+ QDir::addSearchPath("plugins", ConfigManager::inst()->workingDir() + "plugins");
+
discoverPlugins();
}
@@ -127,7 +131,11 @@ void PluginFactory::discoverPlugins()
PluginInfoList pluginInfos;
m_pluginByExt.clear();
- const QFileInfoList& files = QDir("plugins:").entryInfoList(nameFilters);
+ QFileInfoList files;
+ for (const QString& searchPath : QDir::searchPaths("plugins"))
+ {
+ files << QDir(searchPath).entryInfoList(nameFilters);
+ }
// Cheap dependency handling: zynaddsubfx needs ZynAddSubFxCore. By loading
// all libraries twice we ensure that libZynAddSubFxCore is found.
@@ -142,6 +150,7 @@ void PluginFactory::discoverPlugins()
if (! library->load()) {
m_errors[file.baseName()] = library->errorString();
+ qWarning(library->errorString().toLocal8Bit());
continue;
}
if (library->resolve("lmms_plugin_main") == nullptr) {

0 comments on commit 7251c84

Please sign in to comment.