WIP: Associate entry names with directory children

Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
Antonio Scandurra 2021-04-19 20:16:54 +02:00
parent f8f6a85ab0
commit 122926dcde
2 changed files with 85 additions and 207 deletions

View file

@ -128,12 +128,11 @@ where
let skipped_prefix_len = if include_root_name {
0
} else if let Some(Entry::Dir { name, .. }) = snapshot.root_entry() {
let name = name.to_string_lossy();
if name == "/" {
1
} else if let Some(Entry::Dir { .. }) = snapshot.root_entry() {
if let Some(name) = snapshot.root_name() {
name.to_string_lossy().chars().count() + 1
} else {
name.chars().count() + 1
1
}
} else {
0