diff plugin/PiperVampPluginFactory.cpp @ 1464:91bb68146dfc

Add getPluginLibraryPath throughout, in order to provide diagnostic about which plugins were loaded from where
author Chris Cannam
date Fri, 11 May 2018 14:11:04 +0100
parents 87ae75da6527
children cee1be4fb8c1
line wrap: on
line diff
--- a/plugin/PiperVampPluginFactory.cpp	Thu May 10 10:12:13 2018 +0100
+++ b/plugin/PiperVampPluginFactory.cpp	Fri May 11 14:11:04 2018 +0100
@@ -160,6 +160,27 @@
     }
 }
 
+QString
+PiperVampPluginFactory::getPluginLibraryPath(QString identifier)
+{
+    // What we want to return here is the file path of the library in
+    // which the plugin was actually found -- we want to be paranoid
+    // about that and not just query
+    // Vamp::HostExt::PluginLoader::getLibraryPathForPlugin to return
+    // what the SDK thinks the likely location would be (in case our
+    // search order turns out to have been different)
+
+    QStringList bits = identifier.split(':');
+    if (bits.size() > 1) {
+        QString soname = bits[bits.size() - 2];
+        auto i = m_libraries.find(soname);
+        if (i != m_libraries.end()) {
+            return i->second;
+        }
+    }
+    return QString();
+}
+
 void
 PiperVampPluginFactory::populate(QString &errorMessage)
 {
@@ -196,6 +217,7 @@
             string soname = QFileInfo(c.libraryPath).baseName().toStdString();
             SVDEBUG << "INFO: For tag \"" << tag << "\" giving library " << soname << endl;
             from.push_back(soname);
+            m_libraries[QString::fromStdString(soname)] = c.libraryPath;
         }
     }