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.

linux: fix reveal_path for files (#8162)

apricotbucket2840bbd0031d62
diff --git a/crates/gpui/src/platform/linux/platform.rs b/crates/gpui/src/platform/linux/platform.rs
index e6f9dc48944..518c2edfb3b 100644
--- a/crates/gpui/src/platform/linux/platform.rs
+++ b/crates/gpui/src/platform/linux/platform.rs
@@ -294,7 +294,13 @@ impl Platform for LinuxPlatform {
}
fn reveal_path(&self, path: &Path) {
- open::that(path);
+ if path.is_dir() {
+ open::that(path);
+ return;
+ }
+ // If `path` is a file, the system may try to open it in a text editor
+ let dir = path.parent().unwrap_or(Path::new(""));
+ open::that(dir);
}
fn on_become_active(&self, callback: Box<dyn FnMut()>) {