From 02e38bab162da5887c39f63a90e4f8edf169d892 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 28 Jun 2014 21:25:13 +0200 Subject: search-path: filter out duplicates Note: this does not yet take care of filtering dups when directly combining two search-paths. --- libs/pbd/search_path.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'libs/pbd/search_path.cc') 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& 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::const_iterator i = begin(); i != end(); ++i) { + if (*i == directory_path) { + return; + } + } + push_back(directory_path); } void -- cgit v1.2.3