diff src/main.cpp @ 520:30fbc53d8150

Merge latest SV 3.0 branch code
author Chris Cannam
date Fri, 19 Aug 2016 15:58:57 +0100
parents b11b82c2e1af
children 25aa28a27252
line wrap: on
line diff
--- a/src/main.cpp	Sat Jan 30 12:13:45 2016 +0000
+++ b/src/main.cpp	Fri Aug 19 15:58:57 2016 +0100
@@ -23,6 +23,7 @@
 #include "widgets/TipDialog.h"
 #include "widgets/InteractiveFileFinder.h"
 #include "transform/TransformFactory.h"
+#include "svcore/plugin/PluginScan.h"
 
 #include <QMetaType>
 #include <QApplication>
@@ -243,6 +244,28 @@
 
     StoreStartupLocale();
 
+    // Make known-plugins query as early as possible. This depends on
+    // our helper executable, which must exist either in the same
+    // directory as this one or (preferably) a subdirectory called
+    // "checker".
+    QString myDir = application.applicationDirPath();
+    QString helperPath = myDir + "/checker/plugin-checker-helper";
+    QString helperSuffix = "";
+#ifdef _WIN32
+    helperSuffix = ".exe";
+#endif
+    if (!QFile(helperPath + helperSuffix).exists()) {
+        cerr << "NOTE: helper not found at " << (helperPath + helperSuffix)
+             << ", trying in my own directory" << endl;
+        helperPath = myDir + "/plugin-checker-helper";
+    }
+    helperPath += helperSuffix;
+    if (!QFile(helperPath + helperSuffix).exists()) {
+        cerr << "NOTE: helper not found at " << (helperPath + helperSuffix)
+             << endl;
+    }
+    PluginScan::getInstance()->scan(helperPath);
+    
     // Permit size_t and PropertyName to be used as args in queued signal calls
     qRegisterMetaType<size_t>("size_t");
     qRegisterMetaType<PropertyContainer::PropertyName>("PropertyContainer::PropertyName");