tracker r2481 - in trunk: . src/tracker-extract
- From: pvanhoof svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r2481 - in trunk: . src/tracker-extract
- Date: Mon, 10 Nov 2008 13:33:52 +0000 (UTC)
Author: pvanhoof
Date: Mon Nov 10 13:33:52 2008
New Revision: 2481
URL: http://svn.gnome.org/viewvc/tracker?rev=2481&view=rev
Log:
2008-11-10 Philip Van Hoof <philip codeminded be>
* src/tracker-extract/tracker-albumart.c: Function is only available
on very recent versions of glib.
Modified:
trunk/ChangeLog
trunk/src/tracker-extract/tracker-albumart.c
Modified: trunk/src/tracker-extract/tracker-albumart.c
==============================================================================
--- trunk/src/tracker-extract/tracker-albumart.c (original)
+++ trunk/src/tracker-extract/tracker-albumart.c Mon Nov 10 13:33:52 2008
@@ -85,6 +85,70 @@
#endif /* HAVE_STRCASESTR */
+#ifndef g_file_make_directory_with_parents
+
+static gboolean
+g_file_make_directory_with_parents (GFile *file,
+ GCancellable *cancellable,
+ GError **error)
+{
+ gboolean result;
+ GFile *parent_file, *work_file;
+ GList *list = NULL, *l;
+ GError *my_error = NULL;
+
+ if (g_cancellable_set_error_if_cancelled (cancellable, error))
+ return FALSE;
+
+ result = g_file_make_directory (file, cancellable, &my_error);
+ if (result || my_error->code != G_IO_ERROR_NOT_FOUND)
+ {
+ if (my_error)
+ g_propagate_error (error, my_error);
+ return result;
+ }
+
+ work_file = file;
+
+ while (!result && my_error->code == G_IO_ERROR_NOT_FOUND)
+ {
+ g_clear_error (&my_error);
+
+ parent_file = g_file_get_parent (work_file);
+ if (parent_file == NULL)
+ break;
+ result = g_file_make_directory (parent_file, cancellable, &my_error);
+
+ if (!result && my_error->code == G_IO_ERROR_NOT_FOUND)
+ list = g_list_prepend (list, parent_file);
+
+ work_file = parent_file;
+ }
+
+ for (l = list; result && l; l = l->next)
+ {
+ result = g_file_make_directory ((GFile *) l->data, cancellable, &my_error);
+ }
+
+ /* Clean up */
+ while (list != NULL)
+ {
+ g_object_unref ((GFile *) list->data);
+ list = g_list_remove (list, list->data);
+ }
+
+ if (!result)
+ {
+ g_propagate_error (error, my_error);
+ return result;
+ }
+
+ return g_file_make_directory (file, cancellable, error);
+}
+
+
+#endif
+
static gchar*
strip_characters (const gchar *original)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]