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

Function cbm_workspace_home_dir

src/foundation/workspace.c:633–648  ·  view source on GitHub ↗

Callers should not each re-derive these; a caller that resolved the home * directory differently would classify the same path differently. * * The value is the CANONICAL form of $HOME (then %USERPROFILE%), through the * same resolver callers apply to the path they classify. The policy compares * the two byte for byte, and a home reached through a link — "/home" kept on * another volume, a ma

Source from the content-addressed store, hash-verified

631 * does: no lock, a changed environment is seen at once, and the pointer stays
632 * valid until the next call on the same thread. */
633const char *cbm_workspace_home_dir(void) {
634 static CBM_TLS char resolved[CBM_SZ_4K];
635 char raw[CBM_SZ_4K];
636 const char *home = cbm_safe_getenv("HOME", raw, sizeof(raw), NULL);
637 if (!home || !home[0]) {
638 home = cbm_safe_getenv("USERPROFILE", raw, sizeof(raw), NULL);
639 }
640 if (!home || !home[0]) {
641 return NULL;
642 }
643 if (!cbm_canonical_path(home, resolved, sizeof(resolved))) {
644 memcpy(resolved, raw, strlen(raw) + 1);
645 }
646 cbm_normalize_path_sep(resolved);
647 return resolved;
648}
649
650const char *cbm_workspace_cache_dir(void) {
651 return cbm_resolve_cache_dir();

Callers 8

main_run_allow_rootFunction · 0.85
index_status_project_keyFunction · 0.85
handle_index_repositoryFunction · 0.85
maybe_auto_indexFunction · 0.85
handle_index_startFunction · 0.85
test_workspace.cFile · 0.85

Calls 3

cbm_safe_getenvFunction · 0.85
cbm_canonical_pathFunction · 0.85
cbm_normalize_path_sepFunction · 0.85

Tested by 1