diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2008-11-25 11:52:33 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2008-11-25 11:52:33 +0000 |
commit | 8c4c0b7d8022cbad90804dc789b9d359a828d25e (patch) | |
tree | 73305c6c481e13baa8e6158576152a286168f7e4 /libs | |
parent | df2fe18399bb85ab3e2d3dd8c0ddb4b9a7379def (diff) |
colinf's fix for duplicate LADSPA plugins appearing in manager list
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@4253 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/plugin_manager.cc | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/libs/ardour/plugin_manager.cc b/libs/ardour/plugin_manager.cc index 1e4adeba6e..d059f48acd 100644 --- a/libs/ardour/plugin_manager.cc +++ b/libs/ardour/plugin_manager.cc @@ -152,15 +152,42 @@ void PluginManager::ladspa_refresh () { _ladspa_plugin_info.clear (); - static const char *standard_path = "/usr/local/lib64/ladspa:/usr/local/lib/ladspa:/usr/lib64/ladspa:/usr/lib/ladspa:/Library/Audio/Plug-Ins/LADSPA"; + + static const char *standard_paths[] = { + "/usr/local/lib64/ladspa", + "/usr/local/lib/ladspa", + "/usr/lib64/ladspa", + "/usr/lib/ladspa", + "/Library/Audio/Plug-Ins/LADSPA", + "" + }; /* allow LADSPA_PATH to augment, not override standard locations */ - if (ladspa_path.empty()) { - ladspa_path = standard_path; - } else { - ladspa_path += ":"; - ladspa_path += standard_path; + /* Only add standard locations to ladspa_path if it doesn't + * already contain them. Check for trailing '/'s too. + */ + + int i; + for (i = 0; standard_paths[i][0]; i++) { + size_t found = ladspa_path.find(standard_paths[i]); + if (found != ladspa_path.npos) { + switch (ladspa_path[found + strlen(standard_paths[i])]) { + case ':' : + case '\0': + continue; + case '/' : + if (ladspa_path[found + strlen(standard_paths[i]) + 1] == ':' || + ladspa_path[found + strlen(standard_paths[i]) + 1] == '\0') { + continue; + } + } + } + if (!ladspa_path.empty()) + ladspa_path += ":"; + + ladspa_path += standard_paths[i]; + } ladspa_discover_from_path (ladspa_path); |