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.

Use fs to determine if file path is a dir

Kirill Bulatovdf937eaeebea
diff --git a/crates/terminal_view/src/terminal_view.rs b/crates/terminal_view/src/terminal_view.rs
index 7c07d55585d..5372b90bee9 100644
--- a/crates/terminal_view/src/terminal_view.rs
+++ b/crates/terminal_view/src/terminal_view.rs
@@ -193,10 +193,18 @@ impl TerminalView {
}
let potential_abs_paths = possible_open_targets(&workspace, maybe_path, cx);
if let Some(path) = potential_abs_paths.into_iter().next() {
- // TODO kb wrong lib call
- let is_dir = path.path_like.is_dir();
let task_workspace = workspace.clone();
cx.spawn(|_, mut cx| async move {
+ let fs = task_workspace.update(&mut cx, |workspace, cx| {
+ workspace.project().read(cx).fs().clone()
+ })?;
+ let is_dir = fs
+ .metadata(&path.path_like)
+ .await?
+ .with_context(|| {
+ format!("Missing metadata for file {:?}", path.path_like)
+ })?
+ .is_dir;
let opened_items = task_workspace
.update(&mut cx, |workspace, cx| {
workspace.open_paths(