27 #if defined(sun) || defined(__sun) || defined(linux) \
28 || defined(__linux) || defined(__linux__) || defined(__CYGWIN__) \
29 || defined(BSD) || defined(__FreeBSD__) || defined(__OPENBSD__) \
30 || defined(__MACOSX__) || defined(__APPLE__) || defined(sgi) \
32 #include <sys/types.h>
38 #elif defined(_WIN32) || defined(__WIN32__)
48 #define unlink _unlink
50 #define getcwd _getcwd
51 #define CHARON_WINDOWS
53 #error "Operating system not recognized!"
73 std::vector<std::string> dirs;
76 std::string cdir =
"";
77 for (
unsigned int i = 0; i < dirs.size() - 1; ++i) {
79 cdir +=
slash + dirs[i];
88 return mkdir(dir.c_str() MODE);
92 return chdir(dir.c_str());
97 char* res = getcwd(cwd, 2048);
98 if (!res || (res != cwd)) {
99 throw std::runtime_error(
"eror during getcwd");
101 return std::string(cwd);
105 std::vector<std::string> v;
108 struct dirent *entry;
112 entry = readdir(hdir);
114 std::string s = entry->d_name;
115 if (s.find_last_of(
'.') != s.npos && s.substr(s.find_last_of(
'.'),
116 s.length() - s.find_last_of(
'.')) == suffix) {
122 #elif defined CHARON_WINDOWS
127 hFind = FindFirstFile(
".\\*", &ffd);
129 if (INVALID_HANDLE_VALUE == hFind) {
130 throw std::runtime_error(
"Error in opening the folder.");
134 std::string s = ffd.cFileName;
135 if (s.find_last_of(
'.') != s.npos && s.substr(s.find_last_of(
'.'),
136 s.length()) == suffix) {
139 }
while (FindNextFile(hFind, &ffd) != 0);
147 char wrongSlash =
'\\';
149 char wrongSlash =
'/';
151 replace(src.begin(), src.end(), wrongSlash,
slash);
155 std::ifstream test(file.c_str());
160 return unlink(file.c_str());
168 std::ifstream inStream;
169 inStream.open(fName.c_str());
170 std::stringstream str;
172 while (!inStream.eof()) {
173 std::getline(inStream, buffer);
174 str << buffer <<
"\n";