| 98 | } |
| 99 | |
| 100 | static bool cmp_copy(acl::scan_dir& scan, const char* name, |
| 101 | const acl::string& to_path, int* ncopied) |
| 102 | { |
| 103 | const char* rpath = scan.curr_path(); |
| 104 | if (rpath == NULL) |
| 105 | { |
| 106 | logger_error("get current path error: %s, file: %s", |
| 107 | acl::last_serror(), name); |
| 108 | return false; |
| 109 | } |
| 110 | |
| 111 | SKIP(rpath); |
| 112 | SKIP(name); |
| 113 | |
| 114 | // printf(">>rpath: %s\r\n", rpath); |
| 115 | // printf(">>name: %s\r\n", name); |
| 116 | |
| 117 | acl::string from_filepath; |
| 118 | if (*rpath == 0) |
| 119 | from_filepath << name; |
| 120 | else |
| 121 | from_filepath << rpath << SEP << name; |
| 122 | |
| 123 | if (strstr(from_filepath.c_str(), ".svn") != NULL |
| 124 | || strstr(from_filepath.c_str(), ".git") != NULL |
| 125 | || strstr(from_filepath.c_str(), ".cvs") != NULL |
| 126 | || strstr(from_filepath.c_str(), ".inc") != NULL |
| 127 | || strstr(from_filepath.c_str(), ".exe") != NULL |
| 128 | || strstr(from_filepath.c_str(), ".zip") != NULL |
| 129 | || strstr(from_filepath.c_str(), ".rar") != NULL |
| 130 | || strstr(from_filepath.c_str(), ".tar") != NULL |
| 131 | || strstr(from_filepath.c_str(), ".tar.gz") != NULL |
| 132 | || strstr(from_filepath.c_str(), ".tgz") != NULL |
| 133 | || strstr(from_filepath.c_str(), ".bzip2") != NULL |
| 134 | || strstr(from_filepath.c_str(), ".o") != NULL) |
| 135 | { |
| 136 | return true; |
| 137 | } |
| 138 | |
| 139 | acl::ifstream from_fp; |
| 140 | if (from_fp.open_read(from_filepath.c_str()) == false) |
| 141 | { |
| 142 | logger_error("open source file: %s error: %s", |
| 143 | from_filepath.c_str(), acl::last_serror()); |
| 144 | return false; |
| 145 | } |
| 146 | |
| 147 | acl::string to_pathbuf; |
| 148 | acl::string to_filepath; |
| 149 | to_pathbuf << to_path << SEP << rpath; |
| 150 | to_filepath << to_path << SEP << rpath << SEP << name; |
| 151 | |
| 152 | //printf("from_filepath: %s, to_filepath: %s\r\n", |
| 153 | // from_fp.file_path(), to_filepath.c_str()); |
| 154 | |
| 155 | acl::ifstream to_fp; |
| 156 | if (to_fp.open_read(to_filepath.c_str()) == false) |
| 157 | { |
no test coverage detected
searching dependent graphs…