prevent double-listing of LADSPA plugins caused by symlinks to library directories...
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 2 Mar 2009 21:04:39 +0000 (21:04 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 2 Mar 2009 21:04:39 +0000 (21:04 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@4722 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/plugin_manager.cc

index 439768c07ea448b800e235c6c72b08e609dee486..497ac048962ab3ef4329e7fac50f5d64cba06daf 100644 (file)
@@ -313,6 +313,7 @@ PluginManager::ladspa_discover (string path)
        const LADSPA_Descriptor *descriptor;
        LADSPA_Descriptor_Function dfunc;
        const char *errstr;
+       bool first = true;
 
        if ((module = dlopen (path.c_str(), RTLD_NOW)) == 0) {
                error << string_compose(_("LADSPA: cannot load module \"%1\" (%2)"), path, dlerror()) << endmsg;
@@ -364,7 +365,23 @@ PluginManager::ladspa_discover (string path)
                        }
                }
 
-               _ladspa_plugin_info.push_back (info);
+               if(_ladspa_plugin_info.empty()){
+                       _ladspa_plugin_info.push_back (info);
+               }
+
+               //Ensure that the plugin is not already in the plugin list.
+
+               bool found = false;
+
+               for (PluginInfoList::const_iterator i = _ladspa_plugin_info.begin(); i != _ladspa_plugin_info.end(); ++i) {
+                       if(0 == info->unique_id.compare((*i)->unique_id)){
+                             found = true;
+                       }
+               }
+
+               if(!found){
+                   _ladspa_plugin_info.push_back (info);
+               }
        }
 
 // GDB WILL NOT LIKE YOU IF YOU DO THIS