Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Remove wsl command line args on non-windows platforms (#37422)

Max Brunsfeldf23096034b35
diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs
index d67843b4c93..d4b4a350f61 100644
--- a/crates/cli/src/main.rs
+++ b/crates/cli/src/main.rs
@@ -93,6 +93,7 @@ struct Args {
/// Example: `me@Ubuntu` or `Ubuntu`.
///
/// WARN: You should not fill in this field by hand.
+ #[cfg(target_os = "windows")]
#[arg(long, value_name = "USER@DISTRO")]
wsl: Option<String>,
/// Not supported in Zed CLI, only supported on Zed binary
@@ -303,6 +304,11 @@ fn main() -> Result<()> {
]);
}
+ #[cfg(target_os = "windows")]
+ let wsl = args.wsl.as_ref();
+ #[cfg(not(target_os = "windows"))]
+ let wsl = None;
+
for path in args.paths_with_position.iter() {
if path.starts_with("zed://")
|| path.starts_with("http://")
@@ -321,7 +327,7 @@ fn main() -> Result<()> {
paths.push(tmp_file.path().to_string_lossy().to_string());
let (tmp_file, _) = tmp_file.keep()?;
anonymous_fd_tmp_files.push((file, tmp_file));
- } else if let Some(wsl) = &args.wsl {
+ } else if let Some(wsl) = wsl {
urls.push(format!("file://{}", parse_path_in_wsl(path, wsl)?));
} else {
paths.push(parse_path_with_position(path)?);
@@ -340,11 +346,16 @@ fn main() -> Result<()> {
let (_, handshake) = server.accept().context("Handshake after Zed spawn")?;
let (tx, rx) = (handshake.requests, handshake.responses);
+ #[cfg(target_os = "windows")]
+ let wsl = args.wsl;
+ #[cfg(not(target_os = "windows"))]
+ let wsl = None;
+
tx.send(CliRequest::Open {
paths,
urls,
diff_paths,
- wsl: args.wsl,
+ wsl,
wait: args.wait,
open_new_workspace,
env,
diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs
index 3a7baa1559d..52e475edf86 100644
--- a/crates/zed/src/main.rs
+++ b/crates/zed/src/main.rs
@@ -707,11 +707,16 @@ pub fn main() {
.map(|chunk| [chunk[0].clone(), chunk[1].clone()])
.collect();
+ #[cfg(target_os = "windows")]
+ let wsl = args.wsl;
+ #[cfg(not(target_os = "windows"))]
+ let wsl = None;
+
if !urls.is_empty() || !diff_paths.is_empty() {
open_listener.open(RawOpenRequest {
urls,
diff_paths,
- wsl: args.wsl,
+ wsl,
})
}
@@ -1192,6 +1197,7 @@ struct Args {
/// Example: `me@Ubuntu` or `Ubuntu`.
///
/// WARN: You should not fill in this field by hand.
+ #[cfg(target_os = "windows")]
#[arg(long, value_name = "USER@DISTRO")]
wsl: Option<String>,