| 446 | } |
| 447 | |
| 448 | int DoCopyDir2(const char *relative_src_path, const struct stat *src_stat, int typeflag) { |
| 449 | // TODO(walnuthe): dest dir |
| 450 | string dst_dir_path; |
| 451 | const string relative_dst_path{dst_dir_path + relative_src_path}; |
| 452 | switch(typeflag) { |
| 453 | case FTW_D: |
| 454 | mkdir(relative_dst_path.c_str(), src_stat->st_mode); |
| 455 | |
| 456 | break; |
| 457 | case FTW_F: |
| 458 | ifstream src(relative_src_path, ios::binary); |
| 459 | ofstream dst(relative_dst_path, ios::binary); |
| 460 | dst << src.rdbuf(); |
| 461 | |
| 462 | break; |
| 463 | } |
| 464 | |
| 465 | return 0; |
| 466 | } |
| 467 | |
| 468 | int CopyDir2(const string &src_dir_path, const string &dst_dir_path) { |
| 469 | if (-1 == ftw(src_dir_path.c_str(), DoCopyDir2, FTW_MAX_FD)) { |
nothing calls this directly
no outgoing calls
no test coverage detected