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.

Return proper full paths for single file workspaces

Kirill Bulatovfd6f6cc9f8b1
diff --git a/crates/project/src/worktree.rs b/crates/project/src/worktree.rs
index f6fae0c98ba..80fd44761c7 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<Result<String>> {