Resolve Zed's user configuration directory using its documented platform * locations. Linux honors XDG_CONFIG_HOME before ~/.config. */
| 2374 | /* Resolve Zed's user configuration directory using its documented platform |
| 2375 | * locations. Linux honors XDG_CONFIG_HOME before ~/.config. */ |
| 2376 | static void cbm_zed_config_dir(const char *home_dir, char *out, size_t out_sz) { |
| 2377 | if (out_sz == 0) { |
| 2378 | return; |
| 2379 | } |
| 2380 | out[0] = '\0'; |
| 2381 | if (!home_dir || !home_dir[0]) { |
| 2382 | return; |
| 2383 | } |
| 2384 | #ifdef __APPLE__ |
| 2385 | snprintf(out, out_sz, "%s/Library/Application Support/Zed", home_dir); |
| 2386 | #elif defined(_WIN32) |
| 2387 | snprintf(out, out_sz, "%s/AppData/Roaming/Zed", home_dir); |
| 2388 | #else |
| 2389 | char env_buf[CLI_BUF_1K]; |
| 2390 | const char *xdg = cbm_safe_getenv("XDG_CONFIG_HOME", env_buf, sizeof(env_buf), NULL); |
| 2391 | if (xdg && xdg[0]) { |
| 2392 | snprintf(out, out_sz, "%s/zed", xdg); |
| 2393 | } else { |
| 2394 | snprintf(out, out_sz, "%s/.config/zed", home_dir); |
| 2395 | } |
| 2396 | #endif |
| 2397 | } |
| 2398 | |
| 2399 | static void cbm_zed_instructions_path(const char *home_dir, char *out, size_t out_sz) { |
| 2400 | #ifdef _WIN32 |
no test coverage detected