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

Function cbm_resolve_cache_dir

src/foundation/platform.c:517–541  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

515/* ── Cache directory ────────────────────────── */
516
517const char *cbm_resolve_cache_dir(void) {
518 static CBM_TLS char buf[CBM_SZ_4K];
519 static const char missing[] = "\x1f"
520 "CBM_CACHE_DIR_MISSING"
521 "\x1f";
522 const char *configured = cbm_safe_getenv("CBM_CACHE_DIR", buf, sizeof(buf), missing);
523 if (!configured) {
524 /* Present but not representable in the product path bound. */
525 return NULL;
526 }
527 if (strcmp(configured, missing) != 0 && configured[0]) {
528 cbm_normalize_path_sep(buf);
529 return buf;
530 }
531 const char *home = cbm_get_home_dir();
532 if (!home) {
533 return NULL;
534 }
535 int written = snprintf(buf, sizeof(buf), "%s/.cache/codebase-memory-mcp", home);
536 if (written <= 0 || (size_t)written >= sizeof(buf)) {
537 buf[0] = '\0';
538 return NULL;
539 }
540 return buf;
541}

Callers 15

main_build_identityFunction · 0.85
cbm_store_openFunction · 0.85
get_cache_dirFunction · 0.85
cbm_cmd_configFunction · 0.85
delete_cached_project_dbFunction · 0.85
cache_dirFunction · 0.85
write_skip_logfileFunction · 0.85
supervisor_tmp_pathFunction · 0.85
mcp_command_output_pathFunction · 0.85
maybe_auto_indexFunction · 0.85

Calls 3

cbm_safe_getenvFunction · 0.85
cbm_normalize_path_sepFunction · 0.85
cbm_get_home_dirFunction · 0.85

Tested by 3

integration_setupFunction · 0.68
incremental_setupFunction · 0.68