LibGUI: Reify intermediate nodes during index traversal

In the event where you want to find the index of a deeply-nested path
with a GFileSystemModel that hasn't yet traversed most of that path, it
is possible for a false negative failure to occur. This failure is
caused by the GFileSystemModel incorrectly bailing out of the search
when it hits the first unseen path segment that is not at the very end
of the path.

This patch fixes this problem by reifying the intermediate nodes during
that search and traversal process.
This commit is contained in:
Conrad Pankoff 2019-08-01 00:18:47 +10:00 committed by Andreas Kling
parent 246c011497
commit 9b6e99f17e
Notes: sideshowbarker 2024-07-19 12:58:37 +09:00

View File

@ -107,6 +107,7 @@ GModelIndex GFileSystemModel::index(const StringView& path) const
bool found = false;
for (auto& child : node->children) {
if (child->name == part) {
child->reify_if_needed(*this);
node = child;
found = true;
if (i == canonical_path.parts().size() - 1)