From fd6f6cc9f8b10d7bd4307e89099b2c1e5b0d31a5 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Mon, 30 Oct 2023 22:33:44 +0200 Subject: [PATCH] Return proper full paths for single file workspaces --- crates/project/src/worktree.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/project/src/worktree.rs b/crates/project/src/worktree.rs index f6fae0c98b..80fd44761c 100644 --- a/crates/project/src/worktree.rs +++ b/crates/project/src/worktree.rs @@ -2662,12 +2662,12 @@ impl language::File for File { impl language::LocalFile for File { fn abs_path(&self, cx: &AppContext) -> PathBuf { - self.worktree - .read(cx) - .as_local() - .unwrap() - .abs_path - .join(&self.path) + let worktree_path = &self.worktree.read(cx).as_local().unwrap().abs_path; + if self.path.as_ref() == Path::new("") { + worktree_path.to_path_buf() + } else { + worktree_path.join(&self.path) + } } fn load(&self, cx: &AppContext) -> Task> {