Resolve Zed's user configuration directory using its documented platform * locations. Linux honors XDG_CONFIG_HOME before ~/.config. */
| 2187 | /* Resolve Zed's user configuration directory using its documented platform |
| 2188 | * locations. Linux honors XDG_CONFIG_HOME before ~/.config. */ |
| 2189 | static void cbm_zed_config_dir(const char *home_dir, char *out, size_t out_sz) { |
| 2190 | if (out_sz == 0) { |
| 2191 | return; |
| 2192 | } |
| 2193 | out[0] = '\0'; |
| 2194 | if (!home_dir || !home_dir[0]) { |
| 2195 | return; |
| 2196 | } |
| 2197 | #ifdef __APPLE__ |
| 2198 | snprintf(out, out_sz, "%s/Library/Application Support/Zed", home_dir); |
| 2199 | #elif defined(_WIN32) |
| 2200 | snprintf(out, out_sz, "%s/AppData/Roaming/Zed", home_dir); |
| 2201 | #else |
| 2202 | char env_buf[CLI_BUF_1K]; |
| 2203 | const char *xdg = cbm_safe_getenv("XDG_CONFIG_HOME", env_buf, sizeof(env_buf), NULL); |
| 2204 | if (xdg && xdg[0]) { |
| 2205 | snprintf(out, out_sz, "%s/zed", xdg); |
| 2206 | } else { |
| 2207 | snprintf(out, out_sz, "%s/.config/zed", home_dir); |
| 2208 | } |
| 2209 | #endif |
| 2210 | } |
| 2211 | |
| 2212 | static void cbm_zed_instructions_path(const char *home_dir, char *out, size_t out_sz) { |
| 2213 | #ifdef _WIN32 |
no test coverage detected