MCPcopy Create free account
hub / github.com/acl-dev/acl / next_dir

Method next_dir

lib_acl_cpp/src/stdlib/scan_dir.cpp:153–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151}
152
153const char* scan_dir::next_dir(bool full /* = false */)
154{
155 if (scan_ == NULL) {
156 return NULL;
157 }
158
159 const char* dir = acl_scan_dir_next_dir(scan_);
160 if (dir == NULL || *dir == 0) {
161 return NULL;
162 }
163 if (!full) {
164 return dir;
165 }
166
167 const char* path = curr_path();
168 if (path == NULL) {
169 return NULL;
170 }
171
172 if (file_buf_ == NULL) {
173 file_buf_ = NEW string(256);
174 }
175
176#ifdef ACL_WINDOWS
177 file_buf_->format("%s%c%s", path, PATH_SEP_C, dir);
178#else
179 if (*path == '/' && *(path + 1) == 0) {
180 file_buf_->format("%s%s", path, dir);
181 } else {
182 file_buf_->format("%s%c%s", path, PATH_SEP_C, dir);
183 }
184#endif
185
186 return file_buf_->c_str();
187}
188
189const char* scan_dir::next(bool full /* = false */, bool* is_file /* = NULL */)
190{

Callers 1

ls_dirFunction · 0.80

Calls 4

acl_scan_dir_next_dirFunction · 0.85
stringClass · 0.50
formatMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected