From a974a3135e34d58063e30dcb55816fcfe97c0c8f Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 2 Dec 2020 21:34:52 +0100 Subject: [PATCH] Prevent duplicate search paths This fixes an issue with VST3 plugins being listed up multiple times if a user also explicitly adds standard built-in search paths. --- libs/pbd/search_path.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/pbd/search_path.cc b/libs/pbd/search_path.cc index 9e19fce500..178e3ff81f 100644 --- a/libs/pbd/search_path.cc +++ b/libs/pbd/search_path.cc @@ -25,6 +25,7 @@ #include #include +#include "pbd/replace_all.h" #include "pbd/tokenizer.h" #include "pbd/search_path.h" #include "pbd/error.h" @@ -83,7 +84,7 @@ Searchpath::add_directory (const std::string& directory_path) return; } for (vector::const_iterator i = begin(); i != end(); ++i) { - if (*i == directory_path) { + if (poor_mans_glob (*i) == poor_mans_glob(directory_path)) { return; } } @@ -116,7 +117,9 @@ Searchpath::to_string () const Searchpath& Searchpath::operator+= (const Searchpath& spath) { - insert(end(), spath.begin(), spath.end()); + for (vector::const_iterator i = spath.begin(); i != spath.end(); ++i) { + add_directory (*i); + } return *this; }