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

Function cbm_resolve_cache_dir

src/foundation/platform.c:630–654  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

628}
629
630const char *cbm_resolve_cache_dir(void) {
631 static CBM_TLS char buf[CBM_SZ_4K];
632 static const char missing[] = "\x1f"
633 "CBM_CACHE_DIR_MISSING"
634 "\x1f";
635 const char *configured = cbm_safe_getenv("CBM_CACHE_DIR", buf, sizeof(buf), missing);
636 if (!configured) {
637 /* Present but not representable in the product path bound. */
638 return NULL;
639 }
640 if (strcmp(configured, missing) != 0 && configured[0]) {
641 cbm_normalize_path_sep(buf);
642 return buf;
643 }
644 const char *home = cbm_get_home_dir();
645 if (!home) {
646 return NULL;
647 }
648 int written = snprintf(buf, sizeof(buf), "%s/.cache/codebase-memory-mcp", home);
649 if (written <= 0 || (size_t)written >= sizeof(buf)) {
650 buf[0] = '\0';
651 return NULL;
652 }
653 return buf;
654}

Callers 15

main_build_identityFunction · 0.85
mainFunction · 0.85
cbm_store_openFunction · 0.85
get_cache_dirFunction · 0.85
cbm_cmd_configFunction · 0.85
ha_open_crumb_logFunction · 0.85
delete_cached_project_dbFunction · 0.85
cache_dirFunction · 0.85

Calls 3

cbm_safe_getenvFunction · 0.85
cbm_normalize_path_sepFunction · 0.85
cbm_get_home_dirFunction · 0.85

Tested by 4

tic_workFunction · 0.68
integration_setupFunction · 0.68
incremental_setupFunction · 0.68