[eog: 1/2] Allow writing files of which write attribute is unset (#209)
- From: Felix Riemann <friemann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog: 1/2] Allow writing files of which write attribute is unset (#209)
- Date: Sat, 4 Dec 2021 14:55:45 +0000 (UTC)
commit aae47c82e0f6d55a72c16f84a11e006c7c82bafa
Author: wvengen <gnome willem engen nl>
Date: Wed Sep 22 10:09:53 2021 +0200
Allow writing files of which write attribute is unset (#209)
src/eog-image.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/eog-image.c b/src/eog-image.c
index 8cec597c..c10dc40e 100644
--- a/src/eog-image.c
+++ b/src/eog-image.c
@@ -1789,7 +1789,7 @@ check_if_file_is_writable (GFile *file)
GFile *file_to_check;
GFileInfo *file_info;
GError *error = NULL;
- gboolean is_writable;
+ gboolean is_writable, has_writable;
g_return_val_if_fail (G_IS_FILE (file), FALSE);
@@ -1823,9 +1823,16 @@ check_if_file_is_writable (GFile *file)
return FALSE;
}
- /* check if file can be writed */
- is_writable = g_file_info_get_attribute_boolean (file_info,
- G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE);
+ /* check if file can be written */
+ has_writable = g_file_info_has_attribute (file_info,
+ G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE);
+ if (has_writable) {
+ is_writable = g_file_info_get_attribute_boolean (file_info,
+ G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE);
+ } else {
+ /* try writing the file when the writable attribute is absent */
+ is_writable = TRUE;
+ }
/* free objects */
g_object_unref (file_info);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]