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
This commit is contained in:
Colin Walters 2013-01-11 11:10:15 -05:00
parent a1f40adf73
commit 8fe8dcda1e

View File

@ -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)))