Add PBD::Searchpath::contains method to check if a Searchpath contains a path
This commit is contained in:
parent
c07ea1bc73
commit
3bd928591b
@ -134,6 +134,10 @@ public:
|
||||
*/
|
||||
LIBPBD_TEMPLATE_MEMBER_API void remove_directories (const std::vector<std::string>& paths);
|
||||
|
||||
/**
|
||||
* @return true if Searchpath already contains path
|
||||
*/
|
||||
LIBPBD_TEMPLATE_MEMBER_API bool contains (const std::string& path) const;
|
||||
};
|
||||
|
||||
LIBPBD_API void export_search_path (const std::string& base_dir, const char* varname, const char* dir);
|
||||
|
@ -163,6 +163,17 @@ Searchpath::add_subdirectory_to_paths (const string& subdir)
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool
|
||||
Searchpath::contains (const string& path) const
|
||||
{
|
||||
std::vector<std::string>::const_iterator i = find(begin(), end(), path);
|
||||
|
||||
if (i == end()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* This is not part of the Searchpath object, but is closely related to the
|
||||
* whole idea, and we put it here for convenience.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user