Skip to content

Commit f5c89e7

Browse files
committed
pane: Treat empty relative path as if it was None
This is applicable when the file does not belong to any real worktree. We get relative path by trying to remove every available worktree path as prefix of the current file. And when we get to worktree this file "belongs" to we get an empty string. With this change "Copy Relative Path" action will no longer be available for these kinds of files.
1 parent 380679f commit f5c89e7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

crates/workspace/src/pane.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2212,7 +2212,8 @@ impl Pane {
22122212
.read(cx)
22132213
.item_for_entry(entry, cx)
22142214
.and_then(|item| item.project_path(cx))
2215-
.map(|project_path| project_path.path);
2215+
.map(|project_path| project_path.path)
2216+
.map_or(None, |path| if path.exists() { Some(path) } else { None });
22162217

22172218
let entry_id = entry.to_proto();
22182219
menu = menu

0 commit comments

Comments
 (0)