Re: delete non empty directory



On Fri, 2008-10-03 at 22:43 +0200, Kristian Rumberg wrote:
> I would like to be able to delete a directory (even if it's not empty,
> like g_file_delete demands it to be) and track the deletion progress.
> An imaginary  function like
> 
> gboolean            g_file_delete_directory(GFile *dir,
> GFileDeleteFlags flags, GCancellable *cancellable,
> 
> GFileProgressCallback progress_callback, gpointer
> progress_callback_data, GError **error);
> 
> would be optimal for this purpose. libnautilus-private includes code
> that kinda does this but the code is under the GPL and even if it was
> under the LGPL it's stil quite digged into the nautilus code. Is there
> any plans to implement such functionality in gvfs?

Not really. In similar ways you may want recursive file copying, etc.
However, the problem with operations like these are that while they look
simple they really are not. There are many many issues with such an
operation like temporary and permanent partial errors, duplicate
filenames, etc. How you want to handle these issues is very much up to
the application and is hard to generalize.

If you want to represent this with enough API to be useful the call
turns into a gigantic mess, which is hard to understand, hard to use,
and impossible to extend. We tried to do this in gnome-vfs resulting in
the infamous gnome_vfs_xfer function with all these problems.

So, in gio we've decided to support the lower level operations and
expose ways to easily implement the higher level operations in apps.

Of course, it might make sense to implement some operations at a higher
level so that the API itself might show ui dialogs, etc. Maybe in Gtk+
or something...



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]