History

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

Release Notes: - N/A

Max Brunsfeld committed 1 year ago

Commit f2309601 parent 1ed17fd2 files · +20 −3Browse files

Unified · Split

2 files
  1. crates/cli/src/main.rs +13 −2
  2. crates/zed/src/main.rs +7 −1
crates/cli/src/main.rs+13−2
@@ -93,6 +93,7 @@ struct Args { · 92 unmodified lines
9393 /// Example: `me@Ubuntu` or `Ubuntu`.
9494 ///
9595 /// WARN: You should not fill in this field by hand.
96+ #[cfg(target_os = "windows")]
9697 #[arg(long, value_name = "USER@DISTRO")]
9798 wsl: Option<String>,
9899 /// Not supported in Zed CLI, only supported on Zed binary
@@ -303,6 +304,11 @@ fn main() -> Result<()> { · 204 unmodified lines
303304 ]);
304305 }
305306
307+ #[cfg(target_os = "windows")]
308+ let wsl = args.wsl.as_ref();
309+ #[cfg(not(target_os = "windows"))]
310+ let wsl = None;
311+
306312 for path in args.paths_with_position.iter() {
307313 if path.starts_with("zed://")
308314 || path.starts_with("http://")
@@ -321,7 +327,7 @@ fn main() -> Result<()> { · 12 unmodified lines
321327 paths.push(tmp_file.path().to_string_lossy().to_string());
322328 let (tmp_file, _) = tmp_file.keep()?;
323329 anonymous_fd_tmp_files.push((file, tmp_file));
324− } else if let Some(wsl) = &args.wsl {
330+ } else if let Some(wsl) = wsl {
325331 urls.push(format!("file://{}", parse_path_in_wsl(path, wsl)?));
326332 } else {
327333 paths.push(parse_path_with_position(path)?);
@@ -340,11 +346,16 @@ fn main() -> Result<()> { · 12 unmodified lines
340346 let (_, handshake) = server.accept().context("Handshake after Zed spawn")?;
341347 let (tx, rx) = (handshake.requests, handshake.responses);
342348
349+ #[cfg(target_os = "windows")]
350+ let wsl = args.wsl;
351+ #[cfg(not(target_os = "windows"))]
352+ let wsl = None;
353+
343354 tx.send(CliRequest::Open {
344355 paths,
345356 urls,
346357 diff_paths,
347− wsl: args.wsl,
358+ wsl,
348359 wait: args.wait,
349360 open_new_workspace,
350361 env,
crates/zed/src/main.rs+7−1
@@ -707,11 +707,16 @@ pub fn main() { · 706 unmodified lines
707707 .map(|chunk| [chunk[0].clone(), chunk[1].clone()])
708708 .collect();
709709
710+ #[cfg(target_os = "windows")]
711+ let wsl = args.wsl;
712+ #[cfg(not(target_os = "windows"))]
713+ let wsl = None;
714+
710715 if !urls.is_empty() || !diff_paths.is_empty() {
711716 open_listener.open(RawOpenRequest {
712717 urls,
713718 diff_paths,
714− wsl: args.wsl,
719+ wsl,
715720 })
716721 }
717722
@@ -1192,6 +1197,7 @@ struct Args { · 474 unmodified lines
11921197 /// Example: `me@Ubuntu` or `Ubuntu`.
11931198 ///
11941199 /// WARN: You should not fill in this field by hand.
1200+ #[cfg(target_os = "windows")]
11951201 #[arg(long, value_name = "USER@DISTRO")]
11961202 wsl: Option<String>,
11971203