From 728ad64b449f6fc2f67042a35288d73dcd97ece9 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Wed, 8 Feb 2023 11:13:05 +0000 Subject: glocalfileinfo: Ensure boolean file attributes are set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don’t just set them when they’re true and rely on their non-presence being evaluated to `FALSE`. That means that they erroneously don’t get returned in `g_file_info_list_attributes()`. Signed-off-by: Philip Withnall Helps: #2907 --- gio/glocalfileinfo.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'gio/glocalfileinfo.c') diff --git a/gio/glocalfileinfo.c b/gio/glocalfileinfo.c index 420e9d4b2..2b87f692a 100644 --- a/gio/glocalfileinfo.c +++ b/gio/glocalfileinfo.c @@ -2024,6 +2024,8 @@ _g_local_file_info_get (const char *basename, symlink_broken = TRUE; } } + else + g_file_info_set_is_symlink (info, FALSE); if (stat_ok) set_info_from_stat (info, &statbuf, attribute_matcher); @@ -2037,10 +2039,10 @@ _g_local_file_info_get (const char *basename, 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); + g_file_info_set_is_hidden (info, + (basename != NULL && + (basename[0] == '.' || + file_is_hidden (path, basename)))); } if (basename != NULL && basename[strlen (basename) -1] == '~' && -- cgit v1.2.1