From 40bbd0031d6214c3d37da9dc912dab78b95e8e18 Mon Sep 17 00:00:00 2001 From: apricotbucket28 <71973804+apricotbucket28@users.noreply.github.com> Date: Thu, 22 Feb 2024 14:49:36 -0300 Subject: [PATCH] linux: fix reveal_path for files (#8162) Fixes 'Reveal in Finder' opening files instead of showing them in the file explorer. Tested on Fedora KDE 39. Release Notes: - N/A --- crates/gpui/src/platform/linux/platform.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/gpui/src/platform/linux/platform.rs b/crates/gpui/src/platform/linux/platform.rs index e6f9dc4894..518c2edfb3 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) {