[Haiku-commits] r29485 - haiku/trunk/src/apps/expander

axeld at mail.berlios.de axeld at mail.berlios.de
Thu Mar 12 23:37:23 CET 2009


Author: axeld
Date: 2009-03-12 23:37:17 +0100 (Thu, 12 Mar 2009)
New Revision: 29485
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29485&view=rev

Modified:
   haiku/trunk/src/apps/expander/DirectoryFilePanel.cpp
Log:
* 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.


Modified: haiku/trunk/src/apps/expander/DirectoryFilePanel.cpp
===================================================================
--- haiku/trunk/src/apps/expander/DirectoryFilePanel.cpp	2009-03-12 22:11:17 UTC (rev 29484)
+++ haiku/trunk/src/apps/expander/DirectoryFilePanel.cpp	2009-03-12 22:37:17 UTC (rev 29485)
@@ -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 @@
 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;
 }
 
 




More information about the Haiku-commits mailing list