| 308 | } |
| 309 | |
| 310 | static bool empty_dir(const std::string& dir) { |
| 311 | DIR *d; |
| 312 | struct dirent *f; |
| 313 | d = opendir(dir.c_str()); |
| 314 | if (d == NULL) |
| 315 | return false; |
| 316 | while ((f = readdir(d)) != NULL) { |
| 317 | if (strcmp(f->d_name, ".") == 0 || strcmp(f->d_name, "..") == 0) |
| 318 | continue; |
| 319 | return false; |
| 320 | } |
| 321 | return true; |
| 322 | } |
| 323 | |
| 324 | static bool check_dest_dir(const std::string& dir) |
| 325 | // REALLY REALLY REALLY important safety check - without this |
no test coverage detected