[gimp] libgimpbase: use GIO to figure if a file is hidden
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimpbase: use GIO to figure if a file is hidden
- Date: Mon, 7 Dec 2015 00:08:14 +0000 (UTC)
commit 56705bb36c7df8841c6100c5213189cc435d454f
Author: Michael Natterer <mitch gimp org>
Date: Mon Dec 7 01:07:30 2015 +0100
libgimpbase: use GIO to figure if a file is hidden
instead of checking if it starts with '.'.
libgimpbase/gimpdatafiles.c | 24 +++++++-----------------
1 files changed, 7 insertions(+), 17 deletions(-)
---
diff --git a/libgimpbase/gimpdatafiles.c b/libgimpbase/gimpdatafiles.c
index 0bf2520..3a0e194 100644
--- a/libgimpbase/gimpdatafiles.c
+++ b/libgimpbase/gimpdatafiles.c
@@ -41,7 +41,6 @@
static inline gboolean is_script (const gchar *filename);
-static inline gboolean is_hidden (const gchar *filename);
/* public functions */
@@ -99,13 +98,11 @@ gimp_datafiles_read_directories (const gchar *path_str,
GFile *file;
GFileInfo *info;
- if (is_hidden (dir_ent))
- continue;
-
filename = g_build_filename (dirname, dir_ent, NULL);
file = g_file_new_for_path (filename);
info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN ","
G_FILE_ATTRIBUTE_STANDARD_TYPE ","
G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE ","
"time::*",
@@ -133,11 +130,13 @@ gimp_datafiles_read_directories (const gchar *path_str,
g_file_info_get_attribute_uint64 (info,
G_FILE_ATTRIBUTE_TIME_CREATED);
- file_type =
- g_file_info_get_attribute_uint32 (info,
- G_FILE_ATTRIBUTE_STANDARD_TYPE);
+ file_type = g_file_info_get_file_type (info);
- if (flags & G_FILE_TEST_EXISTS)
+ if (g_file_info_get_is_hidden (info))
+ {
+ /* do nothing */
+ }
+ else if (flags & G_FILE_TEST_EXISTS)
{
(* loader_func) (&file_data, user_data);
}
@@ -224,12 +223,3 @@ is_script (const gchar *filename)
return FALSE;
}
-
-static inline gboolean
-is_hidden (const gchar *filename)
-{
- /* skip files starting with '.' so we don't try to parse
- * stuff like .DS_Store or other metadata storage files
- */
- return (filename[0] == '.');
-}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]