| 17 | } |
| 18 | |
| 19 | fn join_single_dir_entries(nodes: &mut Vec<ProjectObjectNode>) { |
| 20 | for node in nodes { |
| 21 | if let ProjectObjectNode::Dir(my_name, my_nodes) = node { |
| 22 | join_single_dir_entries(my_nodes); |
| 23 | // If this directory consists of a single sub-directory... |
| 24 | if let [ProjectObjectNode::Dir(sub_name, sub_nodes)] = &mut my_nodes[..] { |
| 25 | // ... join the two names with a path separator and eliminate the layer |
| 26 | *my_name += "/"; |
| 27 | *my_name += sub_name; |
| 28 | *my_nodes = std::mem::take(sub_nodes); |
| 29 | } |
| 30 | } |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | fn find_dir<'a>( |
| 35 | name: &str, |