diff options
Diffstat (limited to 'libs/pbd/search_path.cc')
-rw-r--r-- | libs/pbd/search_path.cc | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/libs/pbd/search_path.cc b/libs/pbd/search_path.cc index 895bc59909..44438cc85c 100644 --- a/libs/pbd/search_path.cc +++ b/libs/pbd/search_path.cc @@ -50,6 +50,30 @@ Searchpath::Searchpath (const vector<std::string>& paths) } void +Searchpath::remove_directory (const std::string& directory_path) +{ + if (directory_path.empty()) { + return; + } + + for (vector<std::string>::iterator i = begin(); i != end();) { + if (*i == directory_path) { + i = erase (i); + } else { + ++i; + } + } +} + +void +Searchpath::remove_directories (const vector<std::string>& paths) +{ + for(vector<std::string>::const_iterator i = paths.begin(); i != paths.end(); ++i) { + remove_directory (*i); + } +} + +void Searchpath::add_directory (const std::string& directory_path) { if (directory_path.empty()) { @@ -116,6 +140,21 @@ Searchpath::operator+ (const Searchpath& spath) } Searchpath& +Searchpath::operator-= (const Searchpath& spath) +{ + remove_directories (spath); + return *this; +} + +Searchpath& +Searchpath::operator-= (const std::string& directory_path) +{ + remove_directory (directory_path); + return *this; +} + + +Searchpath& Searchpath::add_subdirectory_to_paths (const string& subdir) { for (vector<std::string>::iterator i = begin(); i != end(); ++i) { |