On Sun, 2008-11-09 at 09:52 -0500, Jamie McCracken wrote: > On Sun, 2008-11-09 at 15:34 +0100, Laurent Aguerreche wrote: > > Hi! > > > > tracker-indexer fails to index MP3 files because it relies on a call of > > g_file_make_directory_with_parents, unfortunately this function was only > > added recently and I think it is missing in almost all the glib > > libraries shipped by current linux distributions. In fact, it seems that > > this function has been introduced with GLib 2.17.1 > > ( http://mail.gnome.org/archives/gtk-devel-list/2008-June/msg00155.html ). > > > > Is it possible to avoid the use of this function or to embed a copy of > > it within tracker-extract? > > > > have to agree with laurent here > > why not use g_mkdir_with_parents instead?
Because the location can be on a URI too, not only on a local path Attached patch would embed the code, although this of course duplicates the code from glib. -- Philip Van Hoof, freelance software developer home: me at pvanhoof dot be gnome: pvanhoof at gnome dot org http://pvanhoof.be/blog http://codeminded.be
Index: src/tracker-extract/tracker-albumart.c =================================================================== --- src/tracker-extract/tracker-albumart.c (revision 2459) +++ src/tracker-extract/tracker-albumart.c (working copy) @@ -85,6 +85,70 @@ #endif /* HAVE_STRCASESTR */ +#ifndef g_file_make_directory_with_parents + +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) {
_______________________________________________ tracker-list mailing list tracker-list@gnome.org http://mail.gnome.org/mailman/listinfo/tracker-list