diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index 26a2bf27e0..b4f07c66d3 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -1911,11 +1911,9 @@ impl ProjectPanel { Some(Arc::::from(full_path.join(suffix))) }) }) + .or_else(|| entry.path.file_name().map(Path::new).map(Arc::from)) .unwrap_or_else(|| entry.path.clone()); - let depth = path - .strip_prefix(worktree_abs_path) - .map(|suffix| suffix.components().count()) - .unwrap_or_default(); + let depth = path.components().count(); (depth, path) }; let width_estimate = item_width_estimate(