13
0

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.
This commit is contained in:
Robin Gareus 2020-12-02 21:34:52 +01:00
parent 5fad7e03b2
commit a974a3135e
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -25,6 +25,7 @@
#include <glib.h>
#include <glibmm/miscutils.h>
#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<std::string>::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<std::string>::const_iterator i = spath.begin(); i != spath.end(); ++i) {
add_directory (*i);
}
return *this;
}