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

Function ls_all

lib_acl_cpp/samples/scan_dir/main.cpp:48–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48static void ls_all(acl::scan_dir& scan, const char* path, bool recursive,
49 bool fullpath)
50{
51 if (scan.open(path, recursive) == false) {
52 logger_error("open path: %s error: %s",
53 path, acl::last_serror());
54 return;
55 }
56
57 int ndirs = 0, nfiles = 0;
58 const char* name;
59 bool is_file;
60
61 while ((name = scan.next(fullpath, &is_file)) != NULL) {
62 logger("%s: %s, path: %s", is_file ? "filename" : "dirname",
63 name, scan.curr_path());
64 if (is_file)
65 nfiles++;
66 else
67 ndirs++;
68 }
69
70 logger("===========================================================");
71 logger("total dir count: %d, file count: %d", ndirs, nfiles);
72}
73
74static bool get_relative_path(const char* spath, const char* filepath,
75 acl::string& rpath)

Callers 1

mainFunction · 0.85

Calls 4

curr_pathMethod · 0.80
last_serrorFunction · 0.50
openMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…