Index: lib/ephy-file-helpers.c
===================================================================
--- lib/ephy-file-helpers.c	(revision 7483)
+++ lib/ephy-file-helpers.c	(working copy)
@@ -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 */
@@ -1222,4 +1223,23 @@ 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);
+	}
 }
Index: src/ephy-main.c
===================================================================
--- src/ephy-main.c	(revision 7483)
+++ src/ephy-main.c	(working copy)
@@ -675,7 +675,7 @@ main (int argc,
 
 	if (!ephy_file_helpers_init (profile_directory,
 				     private_instance,
-				     keep_temp_directory,
+				     keep_temp_directory || profile_directory,
 				     &error))
 	{
 		_ephy_dbus_release ();
