| 519 | /* ── App config directories (cross-platform) ────────── */ |
| 520 | |
| 521 | const 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 | |
| 553 | const char *cbm_app_local_dir(void) { |
| 554 | #ifdef _WIN32 |
no test coverage detected