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

Function cbm_app_config_dir

src/foundation/platform.c:521–551  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

519/* ── App config directories (cross-platform) ────────── */
520
521const char *cbm_app_config_dir(void) {
522 static CBM_TLS char buf[CBM_SZ_1K];
523 char tmp[CBM_SZ_256] = "";
524#ifdef _WIN32
525 cbm_safe_getenv("APPDATA", tmp, sizeof(tmp), NULL);
526 if (tmp[0]) {
527 snprintf(buf, sizeof(buf), "%s", tmp);
528 cbm_normalize_path_sep(buf);
529 return buf;
530 }
531 const char *home = cbm_get_home_dir();
532 if (home) {
533 snprintf(buf, sizeof(buf), "%s/AppData/Roaming", home);
534 return buf;
535 }
536 return NULL;
537#else
538 /* Linux: XDG_CONFIG_HOME or ~/.config */
539 cbm_safe_getenv("XDG_CONFIG_HOME", tmp, sizeof(tmp), NULL);
540 if (tmp[0]) {
541 snprintf(buf, sizeof(buf), "%s", tmp);
542 return buf;
543 }
544 const char *home = cbm_get_home_dir();
545 if (home) {
546 snprintf(buf, sizeof(buf), "%s/.config", home);
547 return buf;
548 }
549 return NULL;
550#endif /* _WIN32 */
551}
552
553const char *cbm_app_local_dir(void) {
554#ifdef _WIN32

Callers 4

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