projects
/
ardour.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix libpbd tests.
[ardour.git]
/
libs
/
pbd
/
search_path.cc
diff --git
a/libs/pbd/search_path.cc
b/libs/pbd/search_path.cc
index 9a10557dabaae7e5bcd8c5a3b93edaf3793c7507..f305e24f90ac76db135ea230fa4a7fbece7206b7 100644
(file)
--- a/
libs/pbd/search_path.cc
+++ b/
libs/pbd/search_path.cc
@@
-17,9
+17,11
@@
*/
*/
-#include <pbd/tokenizer.h>
-#include <pbd/search_path.h>
-#include <pbd/error.h>
+#include "pbd/tokenizer.h"
+#include "pbd/search_path.h"
+#include "pbd/error.h"
+
+using namespace std;
namespace {
namespace {
@@
-42,32
+44,26
@@
SearchPath::SearchPath (const string& path)
{
vector<sys::path> tmp;
{
vector<sys::path> tmp;
- if(!tokenize ( path, string(path_delimiter), std::back_inserter (tmp)))
- {
- // log warning(info perhaps?) that the path is empty
- warning << "SearchPath contains no tokens" << endmsg;
-
+ if (tokenize (path, string(path_delimiter), std::back_inserter (tmp))) {
+ add_directories (tmp);
}
}
-
- add_directories (tmp);
}
}
-SearchPath::SearchPath (const
vector<sys::path>& paths
)
+SearchPath::SearchPath (const
sys::path& directory_path
)
{
{
- add_director
ies (paths
);
+ add_director
y (directory_path
);
}
}
-SearchPath::SearchPath (const SearchPath& other)
- : m_dirs(other.m_dirs)
+SearchPath::SearchPath (const vector<sys::path>& paths)
{
{
-
+ add_directories (paths);
}
void
SearchPath::add_directory (const sys::path& directory_path)
{
// test for existance and warn etc?
}
void
SearchPath::add_directory (const sys::path& directory_path)
{
// test for existance and warn etc?
-
m_dirs.
push_back(directory_path);
+ push_back(directory_path);
}
void
}
void
@@
-79,11
+75,11
@@
SearchPath::add_directories (const vector<sys::path>& paths)
}
const string
}
const string
-SearchPath::
get
_string () const
+SearchPath::
to
_string () const
{
string path;
{
string path;
- for (vector<sys::path>::const_iterator i =
m_dirs.begin(); i != m_dirs.
end(); ++i) {
+ for (vector<sys::path>::const_iterator i =
begin(); i !=
end(); ++i) {
path += (*i).to_string();
path += path_delimiter;
}
path += (*i).to_string();
path += path_delimiter;
}
@@
-93,17
+89,10
@@
SearchPath::get_string () const
return path;
}
return path;
}
-SearchPath&
-SearchPath::operator= (const SearchPath& path)
-{
- m_dirs = path.m_dirs;
- return *this;
-}
-
SearchPath&
SearchPath::operator+= (const SearchPath& spath)
{
SearchPath&
SearchPath::operator+= (const SearchPath& spath)
{
-
m_dirs.insert(m_dirs.end(), spath.m_dirs.begin(), spath.m_dirs
.end());
+
insert(end(), spath.begin(), spath
.end());
return *this;
}
return *this;
}
@@
-125,18
+114,14
@@
SearchPath&
SearchPath::operator+ (const SearchPath& spath)
{
// concatenate paths into new SearchPath
SearchPath::operator+ (const SearchPath& spath)
{
// concatenate paths into new SearchPath
-
m_dirs.insert(m_dirs.end(), spath.m_dirs.begin(), spath.m_dirs
.end());
+
insert(end(), spath.begin(), spath
.end());
return *this;
}
SearchPath&
SearchPath::add_subdirectory_to_paths (const string& subdir)
{
return *this;
}
SearchPath&
SearchPath::add_subdirectory_to_paths (const string& subdir)
{
- vector<sys::path> tmp;
- string directory_path;
-
- for (vector<sys::path>::iterator i = m_dirs.begin(); i != m_dirs.end(); ++i)
- {
+ for (vector<sys::path>::iterator i = begin(); i != end(); ++i) {
// should these new paths just be added to the end of
// the search path rather than replace?
*i /= subdir;
// should these new paths just be added to the end of
// the search path rather than replace?
*i /= subdir;
@@
-144,11
+129,5
@@
SearchPath::add_subdirectory_to_paths (const string& subdir)
return *this;
}
return *this;
}
-
-SearchPath&
-SearchPath::operator/= (const string& subdir)
-{
- return add_subdirectory_to_paths (subdir);
-}
} // namespace PBD
} // namespace PBD