| 438 | /* ── Home directory (cross-platform) ───────────────────── */ |
| 439 | |
| 440 | const char *cbm_get_home_dir(void) { |
| 441 | static CBM_TLS char buf[CBM_SZ_1K]; |
| 442 | char tmp[CBM_SZ_256] = ""; |
| 443 | |
| 444 | cbm_safe_getenv("HOME", tmp, sizeof(tmp), NULL); |
| 445 | if (tmp[0]) { |
| 446 | snprintf(buf, sizeof(buf), "%s", tmp); |
| 447 | cbm_normalize_path_sep(buf); |
| 448 | return buf; |
| 449 | } |
| 450 | |
| 451 | cbm_safe_getenv("USERPROFILE", tmp, sizeof(tmp), NULL); |
| 452 | if (tmp[0]) { |
| 453 | snprintf(buf, sizeof(buf), "%s", tmp); |
| 454 | cbm_normalize_path_sep(buf); |
| 455 | return buf; |
| 456 | } |
| 457 | return NULL; |
| 458 | } |
| 459 | |
| 460 | /* ── App config directories (cross-platform) ────────── */ |
| 461 | |