diff options
author | Diego Escalante Urrelo <diegoe@src.gnome.org> | 2007-09-29 05:45:48 +0800 |
---|---|---|
committer | Diego Escalante Urrelo <diegoe@src.gnome.org> | 2007-09-29 05:45:48 +0800 |
commit | 6d689d6e0030c76ce74518af374cfbb0d0960a4c (patch) | |
tree | 99c4f02226e95a26b001f3937adadcd00c595067 /lib | |
parent | bfd1d5ab3539021b0e759756f748ac205f1eb645 (diff) | |
download | gsoc2013-epiphany-6d689d6e0030c76ce74518af374cfbb0d0960a4c.tar gsoc2013-epiphany-6d689d6e0030c76ce74518af374cfbb0d0960a4c.tar.gz gsoc2013-epiphany-6d689d6e0030c76ce74518af374cfbb0d0960a4c.tar.bz2 gsoc2013-epiphany-6d689d6e0030c76ce74518af374cfbb0d0960a4c.tar.lz gsoc2013-epiphany-6d689d6e0030c76ce74518af374cfbb0d0960a4c.tar.xz gsoc2013-epiphany-6d689d6e0030c76ce74518af374cfbb0d0960a4c.tar.zst gsoc2013-epiphany-6d689d6e0030c76ce74518af374cfbb0d0960a4c.zip |
Implement ephy_file_delete_directory in lib/ephy-file-helpers.c so private
instances of Epiphany remove the profile dir on exit.
Note that the profile dir won't be deleted if it's a custom path.
Fixes bug #329680.
svn path=/trunk/; revision=7506
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ephy-file-helpers.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/lib/ephy-file-helpers.c b/lib/ephy-file-helpers.c index 283715c59..3433afeaa 100644 --- a/lib/ephy-file-helpers.c +++ b/lib/ephy-file-helpers.c @@ -36,6 +36,7 @@ #include <libgnomevfs/gnome-vfs-file-info.h> #include <libgnomevfs/gnome-vfs-ops.h> #include <libgnomevfs/gnome-vfs-directory.h> +#include <libgnomevfs/gnome-vfs-xfer.h> #include <libxml/xmlreader.h> /* bug http://bugzilla.gnome.org/show_bug.cgi?id=156687 */ @@ -350,11 +351,8 @@ ephy_file_helpers_shutdown (void) { if (!keep_temp_directory) { - /* recursively delete the contents */ + /* recursively delete the contents and the directory */ ephy_file_delete_directory (tmp_dir); - - /* delete the directory itself too */ - rmdir (tmp_dir); } g_free (tmp_dir); @@ -1218,8 +1216,34 @@ ephy_file_monitor_cancel (EphyFileMonitor *monitor) g_free (monitor); } +/** + * ephy_file_delete_directory: + * @path: the path to remove + * + * Remove @path and its contents. Like calling rm -rf @path. + * + **/ void ephy_file_delete_directory (const char *path) { /* FIXME not implemented yet */ + GList *list; + GnomeVFSResult ret; + + list = g_list_append (NULL, gnome_vfs_uri_new (path)); + + ret = gnome_vfs_xfer_delete_list (list, GNOME_VFS_XFER_ERROR_MODE_ABORT, + GNOME_VFS_XFER_EMPTY_DIRECTORIES, + NULL, NULL); + + gnome_vfs_uri_list_free (list); + + if (ret == GNOME_VFS_OK) + { + LOG ("Deleted the profile dir '%s'", path); + } + else + { + LOG ("Couldn't delete profile dir '%s'", path); + } } |