mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-27 11:48:32 +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:
@@ -159,6 +159,13 @@ void FileSystemModel::Node::traverse_if_needed()
|
||||
}
|
||||
}
|
||||
|
||||
bool FileSystemModel::Node::can_delete_or_move() const
|
||||
{
|
||||
if (!m_can_delete_or_move.has_value())
|
||||
m_can_delete_or_move = FileSystem::can_delete_or_move(full_path());
|
||||
return m_can_delete_or_move.value();
|
||||
}
|
||||
|
||||
OwnPtr<FileSystemModel::Node> FileSystemModel::Node::create_child(DeprecatedString const& child_name)
|
||||
{
|
||||
DeprecatedString child_path = LexicalPath::join(full_path(), child_name).string();
|
||||
|
||||
Reference in New Issue
Block a user