1 #include "MUQ/Utilities/HDF5/PathTools.h"
2 
3 #include <iostream>
4 #include <assert.h>
5 
GetParentPath(std::string const & base)6 std::string muq::Utilities::GetParentPath(std::string const& base)
7 {
8     int lastInd = base.length()-1;
9     if(base[lastInd]=='/')
10    	lastInd--;
11 
12     int pos = base.find_last_of('/',lastInd);
13 
14     return base.substr(0,pos);
15 }
16 
17 
18 
SplitString(std::string const & path)19 std::pair<std::string, std::string> muq::Utilities::SplitString(std::string const& path)
20 {
21   assert(path.length()>1);
22   int i;
23   for(i=1; i<path.length(); ++i)
24   {
25     if(path[i]=='/')
26       break;
27   }
28   std::string nextNode      = path.substr(0,i);
29   std::string remainingPath = path.substr(i,path.length()-i);
30 
31   return make_pair(nextNode,remainingPath);
32 }
33