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

Function cbm_app_config_dir

src/foundation/platform.c:462–492  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

460/* ── App config directories (cross-platform) ────────── */
461
462const char *cbm_app_config_dir(void) {
463 static CBM_TLS char buf[CBM_SZ_1K];
464 char tmp[CBM_SZ_256] = "";
465#ifdef _WIN32
466 cbm_safe_getenv("APPDATA", tmp, sizeof(tmp), NULL);
467 if (tmp[0]) {
468 snprintf(buf, sizeof(buf), "%s", tmp);
469 cbm_normalize_path_sep(buf);
470 return buf;
471 }
472 const char *home = cbm_get_home_dir();
473 if (home) {
474 snprintf(buf, sizeof(buf), "%s/AppData/Roaming", home);
475 return buf;
476 }
477 return NULL;
478#else
479 /* Linux: XDG_CONFIG_HOME or ~/.config */
480 cbm_safe_getenv("XDG_CONFIG_HOME", tmp, sizeof(tmp), NULL);
481 if (tmp[0]) {
482 snprintf(buf, sizeof(buf), "%s", tmp);
483 return buf;
484 }
485 const char *home = cbm_get_home_dir();
486 if (home) {
487 snprintf(buf, sizeof(buf), "%s/.config", home);
488 return buf;
489 }
490 return NULL;
491#endif /* _WIN32 */
492}
493
494const char *cbm_app_local_dir(void) {
495#ifdef _WIN32

Callers 4

cbm_userconfig_loadFunction · 0.85
uninstall_editor_agentsFunction · 0.85
cbm_app_local_dirFunction · 0.85

Calls 3

cbm_safe_getenvFunction · 0.85
cbm_normalize_path_sepFunction · 0.85
cbm_get_home_dirFunction · 0.85

Tested by

no test coverage detected