1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:17:36 +00:00

SpaceAnalyzer: Add a method to TreeNode to get a child node by name

This will make it easier to get to a tree node given a file path
This commit is contained in:
Arda Cinar 2022-12-13 11:16:55 +03:00 committed by Sam Atkins
parent 0d67e60559
commit ba33267132
2 changed files with 11 additions and 0 deletions

View file

@ -128,3 +128,13 @@ HashMap<int, int> TreeNode::populate_filesize_tree(Vector<MountInfo>& mounts, Fu
update_totals();
return error_accumulator;
}
Optional<TreeNode const&> TreeNode::child_with_name(DeprecatedString name) const
{
for (auto& child : *m_children) {
if (child.name() == name)
return child;
}
return {};
}