From 2c5ecffabfb84867262735554152e8e28b0a899f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 12 Mar 2009 22:37:17 +0000 Subject: [PATCH] * Fixed and optimized the directory filter: since it already gets the stat data, calling BNode::IsDirectory() is more expensive. Also, it did not traverse symlinks, and thus left them out. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29485 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/expander/DirectoryFilePanel.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/apps/expander/DirectoryFilePanel.cpp b/src/apps/expander/DirectoryFilePanel.cpp index 15db2bcf8b..231f0b3582 100644 --- a/src/apps/expander/DirectoryFilePanel.cpp +++ b/src/apps/expander/DirectoryFilePanel.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2004-2007, Haiku, Inc. All Rights Reserved. + * Copyright 2004-2009, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -16,7 +16,6 @@ DirectoryRefFilter::DirectoryRefFilter() - : BRefFilter() { } @@ -25,7 +24,16 @@ bool DirectoryRefFilter::Filter(const entry_ref *ref, BNode* node, struct stat *st, const char *filetype) { - return node->IsDirectory(); + if (S_ISDIR(st->st_mode)) + return true; + + if (S_ISLNK(st->st_mode)) { + // Traverse symlinks + BEntry entry(ref, true); + return entry.IsDirectory(); + } + + return false; }