| 99 | } |
| 100 | |
| 101 | bool scan_dir::rmdir_callback(const char* path) |
| 102 | { |
| 103 | #ifdef ACL_WINDOWS |
| 104 | if (_rmdir(path) == 0) { |
| 105 | #else |
| 106 | if (rmdir(path) == 0) { |
| 107 | #endif |
| 108 | logger("rmdir ok, path=%s", path); |
| 109 | return true; |
| 110 | } else { |
| 111 | logger_error("rmdir error=%s, path=%s", last_serror(), path); |
| 112 | return false; |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | const char* scan_dir::next_file(bool full /* = false */) |
| 117 | { |
| 118 | if (scan_ == NULL) { |
| 119 | return NULL; |
| 120 | } |
| 121 | |
| 122 | const char* file = acl_scan_dir_next_file(scan_); |
| 123 | if (file == NULL || *file == 0) { |
| 124 | return NULL; |
| 125 | } |
| 126 | if (!full) { |
| 127 | return file; |
| 128 | } |
| 129 | |
| 130 | const char* path = curr_path(); |
| 131 | if (path == NULL) { |
| 132 | return NULL; |
| 133 | } |
| 134 | |
| 135 | if (file_buf_ == NULL) { |
| 136 | file_buf_ = NEW string(256); |
| 137 | } |
| 138 | |
| 139 | |
| 140 | #ifdef ACL_WINDOWS |
| 141 | file_buf_->format("%s%c%s", path, PATH_SEP_C, file); |
| 142 | #else |
| 143 | if (*path == '/' && *(path + 1) == 0) { |
| 144 | file_buf_->format("%s%s", path, file); |
| 145 | } else { |
| 146 | file_buf_->format("%s%c%s", path, PATH_SEP_C, file); |
| 147 | } |
| 148 | #endif |
| 149 | |
| 150 | return file_buf_->c_str(); |
| 151 | } |
| 152 | |
| 153 | const char* scan_dir::next_dir(bool full /* = false */) |
| 154 | { |
| 155 | if (scan_ == NULL) { |
| 156 | return NULL; |
| 157 | } |
| 158 |
no test coverage detected