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

Function cbm_openclaw_state_dir

src/cli/cli.c:2475–2501  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2473}
2474
2475static bool cbm_openclaw_state_dir(const char *home_dir, char *out, size_t out_sz) {
2476 char internal_home[CLI_BUF_1K];
2477 if (!cbm_openclaw_internal_home(home_dir, internal_home, sizeof(internal_home))) {
2478 return false;
2479 }
2480 char env_buf[CLI_BUF_1K];
2481 const char *custom = cbm_safe_getenv("OPENCLAW_STATE_DIR", env_buf, sizeof(env_buf), NULL);
2482 if (custom && custom[0]) {
2483 return cbm_expand_user_path(internal_home, custom, out, out_sz);
2484 }
2485 char profile_buf[CLI_BUF_256];
2486 const char *profile =
2487 cbm_safe_getenv("OPENCLAW_PROFILE", profile_buf, sizeof(profile_buf), NULL);
2488 const char *separator = "";
2489 const char *profile_name = "";
2490 if (profile && profile[0] && strcmp(profile, "default") != 0) {
2491 for (const unsigned char *p = (const unsigned char *)profile; *p; p++) {
2492 if (!isalnum(*p) && *p != '-' && *p != '_') {
2493 return false;
2494 }
2495 }
2496 separator = "-";
2497 profile_name = profile;
2498 }
2499 int written = snprintf(out, out_sz, "%s/.openclaw%s%s", internal_home, separator, profile_name);
2500 return written > 0 && (size_t)written < out_sz;
2501}
2502
2503static bool cbm_openclaw_config_path(const char *home_dir, char *out, size_t out_sz) {
2504 char internal_home[CLI_BUF_1K];

Callers 2

cbm_openclaw_config_pathFunction · 0.85
cbm_detect_agentsFunction · 0.85

Calls 3

cbm_safe_getenvFunction · 0.85
cbm_expand_user_pathFunction · 0.85

Tested by

no test coverage detected