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

Function cbm_resolve_cache_dir

src/foundation/platform.c:600–624  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

598}
599
600const char *cbm_resolve_cache_dir(void) {
601 static CBM_TLS char buf[CBM_SZ_4K];
602 static const char missing[] = "\x1f"
603 "CBM_CACHE_DIR_MISSING"
604 "\x1f";
605 const char *configured = cbm_safe_getenv("CBM_CACHE_DIR", buf, sizeof(buf), missing);
606 if (!configured) {
607 /* Present but not representable in the product path bound. */
608 return NULL;
609 }
610 if (strcmp(configured, missing) != 0 && configured[0]) {
611 cbm_normalize_path_sep(buf);
612 return buf;
613 }
614 const char *home = cbm_get_home_dir();
615 if (!home) {
616 return NULL;
617 }
618 int written = snprintf(buf, sizeof(buf), "%s/.cache/codebase-memory-mcp", home);
619 if (written <= 0 || (size_t)written >= sizeof(buf)) {
620 buf[0] = '\0';
621 return NULL;
622 }
623 return buf;
624}

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