44 #ifndef GNSSTK_FILEUTILS_HPP
45 #define GNSSTK_FILEUTILS_HPP
50 #include <sys/types.h>
86 inline int makeDir(
const std::string& path,
unsigned mode)
88 std::string temppath = path;
91 std::replace(temppath.begin(), temppath.end(),
'\\',
'/');
92 std::string::size_type i = 0;
94 while ((i = temppath.find(
'/',i+1)) != std::string::npos)
96 std::string thispath(temppath.substr(0,i));
97 if (thispath[thispath.length() - 1] ==
'/')
98 thispath.erase(thispath.length() - 1);
99 _mkdir(thispath.c_str());
102 _mkdir(temppath.c_str());
106 inline int makeDir(
const std::string& path,
unsigned mode)
111 std::string::size_type i = 0;
113 while ((i = path.find(
'/',i+1)) != std::string::npos)
115 std::string thispath(path.substr(0,i));
116 if (thispath[thispath.length() - 1] ==
'/')
117 thispath.erase(thispath.length() - 1);
119 mkdir(thispath.c_str(), mode);
122 mkdir(path.c_str(), mode);
134 inline int makeDir(
const char* path,
unsigned mode)
136 return makeDir(std::string(path), mode);
152 std::ios::openmode mode=std::ios::in)
154 std::fstream test(fname, mode);
159 std::ios::openmode mode=std::ios::in)