Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --user-data-dir CLI flag and propose renaming support_dir to data_dir #26886

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mkungla
Copy link

@mkungla mkungla commented Mar 16, 2025

This PR introduces support for a --user-data-dir CLI flag to override Zed's data directory and proposes renaming support_dir to data_dir for better cross-platform clarity. It builds on the discussion in #25349 about custom data directories, aiming to provide a flexible cross-platform solution.

Changes

The PR is split into two commits:

  1. feat(cli): add --user-data-dir to override data directory
  2. refactor(paths): rename support_dir to data_dir for cross-platform clarity

Context

Inspired by the need for custom data directories discussed in #25349, this PR provides an immediate implementation in the first commit, while the second commit suggests a naming improvement for broader appeal. @mikayla-maki, I’d appreciate your feedback, especially on the rename proposal, given your involvement in the original discussion!

Testing

  • cargo build
  • ./target/debug/zed --user-data-dir ~/custom-data-dir

Release Notes:

  • Added --user-data-dir CLI flag

mkungla added 2 commits March 16, 2025 20:49
Introduces a new CLI flag `--user-data-dir` to allow users to specify a custom directory for Zed's data (e.g., database, extensions, logs). This is implemented by:
- Adding the flag to `crates/cli/src/main.rs` and `crates/zed/src/main.rs`.
- Setting `CUSTOM_DATA_DIR` via `paths::set_custom_data_dir` in both CLI and editor processes.
- Passing the flag via IPC in `CliRequest::Open` for background mode consistency.
…arity

Renames `support_dir` to `data_dir` to better reflect its role as the root directory for
Zed's user data across all platforms. The original name was macOS-specific (aligned with "Application Support"),
which felt less intuitive on Linux (~/.local/share/zed) and Windows (%LOCALAPPDATA%\Zed). This change:
- Updates `crates/paths/src/paths.rs` to use `data_dir` and `DATA_DIR` static.
- Adjusts dependent functions (e.g., `database_dir`, `extensions_dir`) to call `data_dir`.
- Updates callers in `crates/cli/src/main.rs` and other crates as needed.
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Mar 16, 2025
@zed-industries-bot
Copy link

Warnings
⚠️

This PR is missing release notes.

Please add a "Release Notes" section that describes the change:

Release Notes:

- Added/Fixed/Improved ...

If your change is not user-facing, you can use "N/A" for the entry:

Release Notes:

- N/A

Generated by 🚫 dangerJS against affd2fc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants