Addl fix #299: File Compression and Archiving
[geeqie.git] / src / ui_fileops.c
index d14c0ce..2c35490 100644 (file)
@@ -1141,4 +1141,26 @@ gboolean download_web_file(const gchar *text, gboolean minimized, gpointer data)
        return ret;
 
 }
+
+gboolean rmdir_recursive(GFile *file, GCancellable *cancellable, GError **error)
+{
+       g_autoptr(GFileEnumerator) enumerator = NULL;
+
+       enumerator = g_file_enumerate_children(file, G_FILE_ATTRIBUTE_STANDARD_NAME, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, cancellable, NULL);
+
+       while (enumerator != NULL)
+               {
+                GFile *child;
+
+               if (!g_file_enumerator_iterate(enumerator, NULL, &child, cancellable, error))
+                       return FALSE;
+               if (child == NULL)
+                       break;
+               if (!rmdir_recursive(child, cancellable, error))
+                       return FALSE;
+               }
+
+       return g_file_delete(file, cancellable, error);
+}
+
 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */