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

Function rmdir_recursive

src/cli/cli.c:597–621  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

595}
596
597static int rmdir_recursive(const char *path) {
598 char stack[RMDIR_STACK_CAP][CLI_BUF_1K];
599 int top = 0;
600 snprintf(stack[top++], CLI_BUF_1K, "%s", path);
601
602 /* Post-order: collect all dirs depth-first, then rmdir in reverse. */
603 char dirs[RMDIR_STACK_CAP][CLI_BUF_1K];
604 int dir_count = 0;
605
606 while (top > 0) {
607 char *cur = stack[--top];
608 if (dir_count < RMDIR_STACK_CAP) {
609 snprintf(dirs[dir_count++], CLI_BUF_1K, "%s", cur);
610 }
611 rmdir_scan_dir(cur, stack, &top);
612 }
613 /* Remove dirs in reverse (deepest first). */
614 int rc = 0;
615 for (int i = dir_count - CLI_SKIP_ONE; i >= 0; i--) {
616 if (cbm_rmdir(dirs[i]) != 0) {
617 rc = CBM_NOT_FOUND;
618 }
619 }
620 return rc;
621}
622
623/* ── Skill management ─────────────────────────────────────────── */
624

Callers 3

cbm_install_skillsFunction · 0.85
cbm_remove_skillsFunction · 0.85

Calls 2

rmdir_scan_dirFunction · 0.85
cbm_rmdirFunction · 0.85

Tested by

no test coverage detected