Fix libpbd tests.
[ardour.git] / libs / pbd / search_path.cc
index 9a10557dabaae7e5bcd8c5a3b93edaf3793c7507..f305e24f90ac76db135ea230fa4a7fbece7206b7 100644 (file)
 
 */
 
-#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 {
 
@@ -42,32 +44,26 @@ SearchPath::SearchPath (const string& path)
 {
        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_directories (paths);
+       add_directory (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?
-       m_dirs.push_back(directory_path);
+       push_back(directory_path);
 }
 
 void
@@ -79,11 +75,11 @@ SearchPath::add_directories (const vector<sys::path>& paths)
 }
 
 const string
-SearchPath::get_string () const
+SearchPath::to_string () const
 {
        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;
        }
@@ -93,17 +89,10 @@ SearchPath::get_string () const
        return path;
 }
 
-SearchPath&
-SearchPath::operator= (const SearchPath& path)
-{
-       m_dirs = path.m_dirs;
-       return *this;
-}
-
 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;
 }
 
@@ -125,18 +114,14 @@ 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)
 {
-       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;
@@ -144,11 +129,5 @@ SearchPath::add_subdirectory_to_paths (const string& subdir)
        
        return *this;
 }
-       
-SearchPath&
-SearchPath::operator/= (const string& subdir)
-{
-       return add_subdirectory_to_paths (subdir);
-}
 
 } // namespace PBD