
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](https://github.com/zed-industries/zed/pull/26886/commits/28e8889105847401e783d1739722d0998459fe5a)** 2. **[refactor(paths): rename support_dir to data_dir for cross-platform clarity](https://github.com/zed-industries/zed/pull/26886/commits/affd2fc606b39af1b25432a688a9006229a8fc3a)** ### 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 --------- Signed-off-by: Marko Kungla <marko.kungla@gmail.com>
33 lines
909 B
Rust
33 lines
909 B
Rust
use collections::HashMap;
|
|
pub use ipc_channel::ipc;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
pub struct IpcHandshake {
|
|
pub requests: ipc::IpcSender<CliRequest>,
|
|
pub responses: ipc::IpcReceiver<CliResponse>,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
pub enum CliRequest {
|
|
Open {
|
|
paths: Vec<String>,
|
|
urls: Vec<String>,
|
|
wait: bool,
|
|
open_new_workspace: Option<bool>,
|
|
env: Option<HashMap<String, String>>,
|
|
user_data_dir: Option<String>,
|
|
},
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
pub enum CliResponse {
|
|
Ping,
|
|
Stdout { message: String },
|
|
Stderr { message: String },
|
|
Exit { status: i32 },
|
|
}
|
|
|
|
/// When Zed started not as an *.app but as a binary (e.g. local development),
|
|
/// there's a possibility to tell it to behave "regularly".
|
|
pub const FORCE_CLI_MODE_ENV_VAR_NAME: &str = "ZED_FORCE_CLI_MODE";
|