fix mishanding of LXVST (and windows VST) plugin names where the path includes a...
[ardour.git] / libs / ardour / panner_manager.cc
index fa500ea85ee3794221d17cc108ab42c5a624e513..c3601d41de46b21b94d30a03e54c561cd8e16f8a 100644 (file)
@@ -1,9 +1,32 @@
+/*
+    Copyright (C) 2011 Paul Davis
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <unistd.h>
+
 #include <glibmm/pattern.h>
+#include <glibmm/fileutils.h>
 
 #include "pbd/error.h"
 #include "pbd/compose.h"
 #include "pbd/file_utils.h"
 
+#include "ardour/debug.h"
 #include "ardour/panner_manager.h"
 #include "ardour/panner_search_path.h"
 
@@ -39,7 +62,7 @@ PannerManager::instance ()
 void
 PannerManager::discover_panners ()
 {
-       vector<sys::path> panner_modules;
+       vector<std::string> panner_modules;
 
        Glib::PatternSpec so_extension_pattern("*.so");
        Glib::PatternSpec dylib_extension_pattern("*.dylib");
@@ -50,10 +73,10 @@ PannerManager::discover_panners ()
        find_matching_files_in_search_path (panner_search_path (),
                                            dylib_extension_pattern, panner_modules);
 
-       info << string_compose (_("looking for panners in %1"), panner_search_path().to_string()) << endmsg;
+       DEBUG_TRACE (DEBUG::Panning, string_compose (_("looking for panners in %1"), panner_search_path().to_string()));
 
-       for (vector<sys::path>::iterator i = panner_modules.begin(); i != panner_modules.end(); ++i) {
-               panner_discover ((*i).to_string());
+       for (vector<std::string>::iterator i = panner_modules.begin(); i != panner_modules.end(); ++i) {
+               panner_discover (*i);
        }
 }
 int
@@ -62,8 +85,19 @@ PannerManager::panner_discover (string path)
        PannerInfo* pinfo;
 
        if ((pinfo = get_descriptor (path)) != 0) {
-               panner_info.push_back (pinfo);
-               info << string_compose(_("Panner discovered: \"%1\""), pinfo->descriptor.name) << endmsg;
+
+               list<PannerInfo*>::iterator i;
+
+               for (i = panner_info.begin(); i != panner_info.end(); ++i) {
+                       if (pinfo->descriptor.name == (*i)->descriptor.name) {
+                               break;
+                       }
+               }
+
+               if (i == panner_info.end()) {
+                       panner_info.push_back (pinfo);
+                       DEBUG_TRACE (DEBUG::Panning, string_compose(_("Panner discovered: \"%1\" in %2"), pinfo->descriptor.name, path));
+               }
        }
 
        return 0;