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

Method open

lib_acl_cpp/src/stdlib/scan_dir.cpp:49–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49bool scan_dir::open(const char* path, bool recursive /* = true */,
50 bool rmdir_on /* = false */)
51{
52 if (path == NULL || *path == 0) {
53 logger_error("path null");
54 return false;
55 }
56
57 // �ȹر�֮ǰ���ܴ򿪵ľ�����Է�ֹ��Դй©
58 close();
59
60 unsigned flags = 0;
61 if (recursive) {
62 flags |= ACL_SCAN_FLAG_RECURSIVE;
63 }
64 if (rmdir_on) {
65 flags |= ACL_SCAN_FLAG_RMDIR;
66 }
67
68 path_ = acl_mystrdup(path);
69 scan_ = acl_scan_dir_open2(path_, flags);
70 if (scan_ == NULL) {
71 logger_error("open dir: %s error: %s", path_, last_serror());
72 acl_myfree(path_);
73 return false;
74 }
75
76 if (rmdir_on) {
77 set_rmdir_callback(rmdir_def, this);
78 }
79
80 return true;
81}
82
83void scan_dir::set_rmdir_callback(int (*fn)(ACL_SCAN_DIR*, const char*, void*),
84 void* ctx)

Callers 2

all_sizeMethod · 0.45
remove_allMethod · 0.45

Calls 3

acl_scan_dir_open2Function · 0.85
last_serrorFunction · 0.70
closeFunction · 0.50

Tested by

no test coverage detected