From 85df94505d91c359e1d1da2984d63ed7f6f53be8 Mon Sep 17 00:00:00 2001 From: Iain Holmes Date: Thu, 12 Jul 2001 20:20:08 +0000 Subject: Fix the importers if you try to import into an already existing directory svn path=/trunk/; revision=11058 --- mail/ChangeLog | 5 +++ mail/importers/evolution-mbox-importer.c | 53 ++++++++++++++++++++------------ 2 files changed, 38 insertions(+), 20 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index a4118fd31d..46e2e49ac5 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,8 @@ +2001-07-12 Iain Holmes + + * importers/evolution-mbox-importer.c (load_file_fn): Check that the folder + does exist before trying to import it. + 2001-07-12 Jeffrey Stedfast * mail-callbacks.c (expunge_folder): Force-hide all deleted diff --git a/mail/importers/evolution-mbox-importer.c b/mail/importers/evolution-mbox-importer.c index da01fcfefc..d3f6322b9b 100644 --- a/mail/importers/evolution-mbox-importer.c +++ b/mail/importers/evolution-mbox-importer.c @@ -233,30 +233,43 @@ load_file_fn (EvolutionImporter *eimporter, } importer->mstream = NULL; - if (folderpath == NULL || *folderpath == '\0') + if (folderpath == NULL || *folderpath == '\0') { importer->folder = mail_tool_get_local_inbox (NULL); - else { + } else { char *parent; - const char *name; + const char *name, *fullpath, *homedir, *tmp; BonoboListener *listener; - - /* Make a new directory */ - name = strrchr (folderpath, '/'); - if (name == NULL) { - parent = g_strdup ("/"); - name = folderpath; - } else { - name += 1; - parent = g_dirname (folderpath); + CamelException *ex; + + tmp = gnome_util_prepend_user_home ("evolution/local"); + homedir = g_strconcat ("file://", tmp, NULL); + g_free (tmp); + + fullpath = e_path_to_physical (homedir, folderpath); + ex = camel_exception_new (); + importer->folder = mail_tool_uri_to_folder (fullpath, ex); + + if (camel_exception_is_set (ex) || importer->folder == NULL) { + /* Make a new directory */ + name = strrchr (folderpath, '/'); + if (name == NULL) { + parent = g_strdup ("/"); + name = folderpath; + } else { + name += 1; + parent = g_dirname (folderpath); + } + + listener = bonobo_listener_new (NULL, NULL); + gtk_signal_connect (GTK_OBJECT (listener), "event-notify", + GTK_SIGNAL_FUNC (folder_created_cb), + importer); + + mail_importer_create_folder (parent, name, NULL, listener); + g_free (parent); } - - listener = bonobo_listener_new (NULL, NULL); - gtk_signal_connect (GTK_OBJECT (listener), "event-notify", - GTK_SIGNAL_FUNC (folder_created_cb), - importer); - - mail_importer_create_folder (parent, name, NULL, listener); - g_free (parent); + camel_exception_free (ex); + g_free (fullpath); } if (importer->folder == NULL){ -- cgit v1.2.3