| 467 | /* ── Home directory (cross-platform) ───────────────────── */ |
| 468 | |
| 469 | const char *cbm_get_home_dir(void) { |
| 470 | static CBM_TLS char buf[CBM_SZ_1K]; |
| 471 | char tmp[CBM_SZ_256] = ""; |
| 472 | |
| 473 | cbm_safe_getenv("HOME", tmp, sizeof(tmp), NULL); |
| 474 | if (tmp[0]) { |
| 475 | snprintf(buf, sizeof(buf), "%s", tmp); |
| 476 | cbm_normalize_path_sep(buf); |
| 477 | return buf; |
| 478 | } |
| 479 | |
| 480 | cbm_safe_getenv("USERPROFILE", tmp, sizeof(tmp), NULL); |
| 481 | if (tmp[0]) { |
| 482 | snprintf(buf, sizeof(buf), "%s", tmp); |
| 483 | cbm_normalize_path_sep(buf); |
| 484 | return buf; |
| 485 | } |
| 486 | return NULL; |
| 487 | } |
| 488 | |
| 489 | /* ── App config directories (cross-platform) ────────── */ |
| 490 | |