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

Function cbm_claude_user_root

src/cli/cli.c:1138–1150  ·  view source on GitHub ↗

Resolve the parent dir containing `.claude.json` (Claude Code's user config file). * Honors $CLAUDE_CONFIG_DIR; falls back to "$home_dir". */

Source from the content-addressed store, hash-verified

1136/* Resolve the parent dir containing `.claude.json` (Claude Code's user config file).
1137 * Honors $CLAUDE_CONFIG_DIR; falls back to "$home_dir". */
1138static void cbm_claude_user_root(const char *home_dir, char *out, size_t out_sz) {
1139 if (out_sz == 0) {
1140 return;
1141 }
1142 out[0] = '\0';
1143 char env_buf[CLI_BUF_1K];
1144 const char *env = cbm_safe_getenv("CLAUDE_CONFIG_DIR", env_buf, sizeof(env_buf), NULL);
1145 if (env && env[0]) {
1146 snprintf(out, out_sz, "%s", env);
1147 } else if (home_dir && home_dir[0]) {
1148 snprintf(out, out_sz, "%s", home_dir);
1149 }
1150}
1151
1152/* Build the hook command string written into Claude Code's settings.json.
1153 * Honors $CLAUDE_CONFIG_DIR. When CLAUDE_CONFIG_DIR is unset, preserves the

Callers 2

uninstall_claude_codeFunction · 0.85

Calls 1

cbm_safe_getenvFunction · 0.85

Tested by

no test coverage detected