[glib] glocalfile: Only check for .hidden files if standard::is-hidden is requested



commit 8fe8dcda1e6c3d799a0409ef983811d9c659a3cf
Author: Colin Walters <walters verbum org>
Date:   Fri Jan 11 11:10:15 2013 -0500

    glocalfile: Only check for .hidden files if standard::is-hidden is requested
    
    For OSTree, I use Gio and also really care about performance.  It's
    disturbing to see open('.hidden') all over my straces and such.  At
    the moment I have an explicit set of things to query, as opposed to
    "standard::*", since even before this that also implies an lstat() of
    the parent directory.
    
    This matches up with what we do for all the other attributes.
    
    See https://bugzilla.gnome.org/show_bug.cgi?id=587806
    https://bugzilla.gnome.org/show_bug.cgi?id=691558

 gio/glocalfileinfo.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/gio/glocalfileinfo.c b/gio/glocalfileinfo.c
index 831a20b..98f7664 100644
--- a/gio/glocalfileinfo.c
+++ b/gio/glocalfileinfo.c
@@ -1788,10 +1788,14 @@ _g_local_file_info_get (const char             *basename,
 #endif
 
 #ifndef G_OS_WIN32
-  if (basename != NULL &&
-      (basename[0] == '.' ||
-       file_is_hidden (path, basename)))
-    g_file_info_set_is_hidden (info, TRUE);
+  if (_g_file_attribute_matcher_matches_id (attribute_matcher,
+					    G_FILE_ATTRIBUTE_ID_STANDARD_IS_HIDDEN))
+    {
+      if (basename != NULL &&
+          (basename[0] == '.' ||
+           file_is_hidden (path, basename)))
+        g_file_info_set_is_hidden (info, TRUE);
+    }
 
   if (basename != NULL && basename[strlen (basename) -1] == '~' &&
       (stat_ok && S_ISREG (statbuf.st_mode)))



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]