MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cbm_readdir

Function cbm_readdir

src/foundation/compat_fs.c:89–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89cbm_dirent_t *cbm_readdir(cbm_dir_t *d) {
90 if (!d || d->done) {
91 return NULL;
92 }
93 if (!d->first) {
94 if (!FindNextFileW(d->find_handle, &d->find_data)) {
95 d->done = true;
96 return NULL;
97 }
98 }
99 d->first = false;
100
101 while (d->find_data.cFileName[0] == L'.' &&
102 (d->find_data.cFileName[1] == L'\0' ||
103 (d->find_data.cFileName[1] == L'.' && d->find_data.cFileName[2] == L'\0'))) {
104 if (!FindNextFileW(d->find_handle, &d->find_data)) {
105 d->done = true;
106 return NULL;
107 }
108 }
109
110 char *u8 = cbm_wide_to_utf8(d->find_data.cFileName);
111 if (!u8) {
112 d->done = true;
113 return NULL;
114 }
115 size_t nlen = strlen(u8);
116 if (nlen >= CBM_DIRENT_NAME_MAX) {
117 nlen = CBM_DIRENT_NAME_MAX - SKIP_ONE;
118 }
119 memcpy(d->entry.name, u8, nlen);
120 d->entry.name[nlen] = '\0';
121 free(u8);
122 d->entry.is_dir = (d->find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
123 d->entry.d_type = 0;
124 return &d->entry;
125}
126
127int cbm_path_info_utf8(const char *path, cbm_path_info_t *out) {
128 if (!path || !out) {

Callers 15

spill_sweep_orphansFunction · 0.85
walk_dirFunction · 0.85
cli.cFile · 0.85
cbm_list_indexesFunction · 0.85
cbm_remove_indexesFunction · 0.85
count_db_indexesFunction · 0.85
resolve_project_tailFunction · 0.85
collect_db_project_namesFunction · 0.85

Calls 2

cbm_wide_to_utf8Function · 0.85
readdirFunction · 0.85

Tested by 15

hl_count_straysFunction · 0.68
count_temp_outputs_forFunction · 0.68
find_temp_output_forFunction · 0.68
cx_copy_entryFunction · 0.68
cx_build_corpusFunction · 0.68
cte_temp_countFunction · 0.68
pf_directory_onlyFunction · 0.68
mcp_find_corrupt_backupsFunction · 0.68