Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Include code only on macOS
Petros Amoiridis914379060229
diff --git a/crates/util/src/lib.rs b/crates/util/src/lib.rsindex 5b12502389b..c3376f2e786 100644--- a/crates/util/src/lib.rs+++ b/crates/util/src/lib.rs@@ -56,19 +56,25 @@ pub fn truncate_and_trailoff(s: &str, max_chars: usize) -> String {pub fn open<P: AsRef<Path>>(path: P) {let path_to_open = path.as_ref().to_string_lossy();- std::process::Command::new("open")- .arg(path_to_open.as_ref())- .spawn()- .log_err();+ #[cfg(target_os = "macos")]+ {+ std::process::Command::new("open")+ .arg(path_to_open.as_ref())+ .spawn()+ .log_err();+ }}pub fn reveal_in_finder<P: AsRef<Path>>(path: P) {let path_to_reveal = path.as_ref().to_string_lossy();- std::process::Command::new("open")- .arg("-R") // To reveal in Finder instead of opening the file- .arg(path_to_reveal.as_ref())- .spawn()- .log_err();+ #[cfg(target_os = "macos")]+ {+ std::process::Command::new("open")+ .arg("-R") // To reveal in Finder instead of opening the file+ .arg(path_to_reveal.as_ref())+ .spawn()+ .log_err();+ }}pub fn post_inc<T: From<u8> + AddAssign<T> + Copy>(value: &mut T) -> T {