Resolve Zed's user configuration directory using its documented platform * locations. Linux honors XDG_CONFIG_HOME before ~/.config. */
| 2221 | /* Resolve Zed's user configuration directory using its documented platform |
| 2222 | * locations. Linux honors XDG_CONFIG_HOME before ~/.config. */ |
| 2223 | static void cbm_zed_config_dir(const char *home_dir, char *out, size_t out_sz) { |
| 2224 | if (out_sz == 0) { |
| 2225 | return; |
| 2226 | } |
| 2227 | out[0] = '\0'; |
| 2228 | if (!home_dir || !home_dir[0]) { |
| 2229 | return; |
| 2230 | } |
| 2231 | #ifdef __APPLE__ |
| 2232 | snprintf(out, out_sz, "%s/Library/Application Support/Zed", home_dir); |
| 2233 | #elif defined(_WIN32) |
| 2234 | snprintf(out, out_sz, "%s/AppData/Roaming/Zed", home_dir); |
| 2235 | #else |
| 2236 | char env_buf[CLI_BUF_1K]; |
| 2237 | const char *xdg = cbm_safe_getenv("XDG_CONFIG_HOME", env_buf, sizeof(env_buf), NULL); |
| 2238 | if (xdg && xdg[0]) { |
| 2239 | snprintf(out, out_sz, "%s/zed", xdg); |
| 2240 | } else { |
| 2241 | snprintf(out, out_sz, "%s/.config/zed", home_dir); |
| 2242 | } |
| 2243 | #endif |
| 2244 | } |
| 2245 | |
| 2246 | static void cbm_zed_instructions_path(const char *home_dir, char *out, size_t out_sz) { |
| 2247 | #ifdef _WIN32 |
no test coverage detected