glocalfileinfo: Ensure that is-backup is always set

Currently, the `G_FILE_ATTRIBUTE_STANDARD_IS_BACKUP` attribute is set
only when its value is `TRUE`. This is wrong with the latest changes as
the `GLib-GIO-CRITICAL **: 00:54:07.260: GFileInfo created without
standard::is-backup` errors are printed now from the
`g_file_info_get_is_backup` function among others. Let's set this
aattribute also when it is `FALSE`.

Related: https://gitlab.gnome.org/GNOME/glib/-/issues/2934
This commit is contained in:
Ondrej Holy 2023-03-06 13:38:40 +01:00
parent e75ba524fd
commit 448a163bee

View File

@ -2049,9 +2049,10 @@ _g_local_file_info_get (const char *basename,
file_is_hidden (path, basename))));
}
if (basename != NULL && basename[strlen (basename) -1] == '~' &&
(stat_ok && S_ISREG (_g_stat_mode (&statbuf))))
_g_file_info_set_attribute_boolean_by_id (info, G_FILE_ATTRIBUTE_ID_STANDARD_IS_BACKUP, TRUE);
_g_file_info_set_attribute_boolean_by_id (info,
G_FILE_ATTRIBUTE_ID_STANDARD_IS_BACKUP,
basename != NULL && basename[strlen (basename) - 1] == '~' &&
(stat_ok && S_ISREG (_g_stat_mode (&statbuf))));
#else
if (statbuf.attributes & FILE_ATTRIBUTE_HIDDEN)
g_file_info_set_is_hidden (info, TRUE);