1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:48:12 +00:00

FileManager+LibGUI: Cache the FileSystem::can_delete_or_move value

Add the function FileSystemModel::Node::can_delete_or_move which will
cache the result of FileSystem::can_delete_or_move for a node. This
prevents having to make system calls repeatedly to obtain this
information.

Fixes #18399
This commit is contained in:
Tom 2023-04-16 14:15:10 -06:00 committed by Linus Groh
parent d824d07784
commit e758545b91
3 changed files with 11 additions and 1 deletions

View file

@ -547,7 +547,7 @@ bool DirectoryView::can_modify_current_selection()
// FIXME: remove once Clang formats this properly.
// clang-format off
return selections.first_matching([&](auto& index) {
return FileSystem::can_delete_or_move(node(index).full_path());
return node(index).can_delete_or_move();
}).has_value();
// clang-format on
}