Resolve Zed's user configuration directory using its documented platform * locations. Linux honors XDG_CONFIG_HOME before ~/.config. */
| 2659 | /* Resolve Zed's user configuration directory using its documented platform |
| 2660 | * locations. Linux honors XDG_CONFIG_HOME before ~/.config. */ |
| 2661 | static void cbm_zed_config_dir(const char *home_dir, char *out, size_t out_sz) { |
| 2662 | if (out_sz == 0) { |
| 2663 | return; |
| 2664 | } |
| 2665 | out[0] = '\0'; |
| 2666 | if (!home_dir || !home_dir[0]) { |
| 2667 | return; |
| 2668 | } |
| 2669 | #ifdef __APPLE__ |
| 2670 | snprintf(out, out_sz, "%s/Library/Application Support/Zed", home_dir); |
| 2671 | #elif defined(_WIN32) |
| 2672 | snprintf(out, out_sz, "%s/AppData/Roaming/Zed", home_dir); |
| 2673 | #else |
| 2674 | char env_buf[CLI_BUF_1K]; |
| 2675 | const char *xdg = cbm_safe_getenv("XDG_CONFIG_HOME", env_buf, sizeof(env_buf), NULL); |
| 2676 | if (xdg && xdg[0]) { |
| 2677 | snprintf(out, out_sz, "%s/zed", xdg); |
| 2678 | } else { |
| 2679 | snprintf(out, out_sz, "%s/.config/zed", home_dir); |
| 2680 | } |
| 2681 | #endif |
| 2682 | } |
| 2683 | |
| 2684 | static void cbm_zed_instructions_path(const char *home_dir, char *out, size_t out_sz) { |
| 2685 | #ifdef _WIN32 |
no test coverage detected