+#ifndef VST_SCANNER_APP
+ std::string scanner_bin_path = ARDOUR::PluginManager::scanner_bin_path;
+
+ if (mode == VST_SCAN_CACHE_ONLY) {
+ /* never scan explicitly, use cache only */
+ return infos;
+ }
+ else if (mode == VST_SCAN_USE_APP && scanner_bin_path != "") {
+ /* use external scanner app */
+
+ char **argp= (char**) calloc (3,sizeof (char*));
+ argp[0] = strdup (scanner_bin_path.c_str ());
+ argp[1] = strdup (dllpath);
+ argp[2] = 0;
+
+ set_error_log (dllpath);
+ ARDOUR::SystemExec scanner (scanner_bin_path, argp);
+ PBD::ScopedConnectionList cons;
+ scanner.ReadStdout.connect_same_thread (cons, boost::bind (&parse_scanner_output, _1 ,_2));
+ if (scanner.start (2 /* send stderr&stdout via signal */)) {
+ PBD::error << string_compose (_("Cannot launch VST scanner app '%1': %2"), scanner_bin_path, strerror (errno)) << endmsg;
+ close_error_log ();
+ return infos;
+ } else {
+ int timeout = PLUGIN_SCAN_TIMEOUT;
+ bool no_timeout = (timeout <= 0);
+ ARDOUR::PluginScanTimeout (timeout);
+ while (scanner.is_running () && (no_timeout || timeout > 0)) {
+ if (!no_timeout && !ARDOUR::PluginManager::instance ().no_timeout ()) {
+ if (timeout%5 == 0) {
+ ARDOUR::PluginScanTimeout (timeout);
+ }
+ --timeout;
+ }
+ ARDOUR::GUIIdle ();
+ Glib::usleep (100000);
+
+ if (ARDOUR::PluginManager::instance ().cancelled ()) {
+ // remove info file (might be incomplete)
+ vstfx_remove_infofile (dllpath);
+ // remove temporary blacklist file (scan incomplete)
+ vstfx_un_blacklist (dllpath);
+ scanner.terminate ();
+ close_error_log ();
+ return infos;
+ }
+ }
+ scanner.terminate ();
+ }
+ close_error_log ();
+ /* re-read index (generated by external scanner) */
+ vstfx_clear_info_list (infos);
+ if (!vst_is_blacklisted (dllpath)) {
+ vstfx_get_info_from_file (dllpath, infos);
+ }
+ return infos;
+ }
+ /* else .. instantiate and check in in ardour process itself */
+#else
+ (void) mode; // unused parameter
+#endif
+