diff options
author | Robin Gareus <robin@gareus.org> | 2014-06-28 21:25:13 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2014-06-28 22:02:20 +0200 |
commit | 02e38bab162da5887c39f63a90e4f8edf169d892 (patch) | |
tree | 9fb1306ff74cdf5617e120557df5650555c951b1 /libs/pbd/search_path.cc | |
parent | dcca72dabd9e134af1029bf2cf4c8ab87f6aa284 (diff) |
search-path: filter out duplicates
Note: this does not yet take care of filtering dups
when directly combining two search-paths.
Diffstat (limited to 'libs/pbd/search_path.cc')
-rw-r--r-- | libs/pbd/search_path.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libs/pbd/search_path.cc b/libs/pbd/search_path.cc index c441c01211..895bc59909 100644 --- a/libs/pbd/search_path.cc +++ b/libs/pbd/search_path.cc @@ -52,9 +52,15 @@ Searchpath::Searchpath (const vector<std::string>& paths) void Searchpath::add_directory (const std::string& directory_path) { - if (!directory_path.empty()) { - push_back(directory_path); + if (directory_path.empty()) { + return; } + for (vector<std::string>::const_iterator i = begin(); i != end(); ++i) { + if (*i == directory_path) { + return; + } + } + push_back(directory_path); } void |