MCPcopy Create free account
hub / github.com/Tencent/phxqueue / DoCopyDir2

Function DoCopyDir2

phxqueue/comm/utils/file_util.cpp:448–466  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

446}
447
448int 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
468int CopyDir2(const string &src_dir_path, const string &dst_dir_path) {
469 if (-1 == ftw(src_dir_path.c_str(), DoCopyDir2, FTW_MAX_FD)) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected