aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorIain Holmes <iain@src.gnome.org>2001-07-13 04:20:08 +0800
committerIain Holmes <iain@src.gnome.org>2001-07-13 04:20:08 +0800
commit85df94505d91c359e1d1da2984d63ed7f6f53be8 (patch)
tree357b521eac418ddcbdb7070e01ab2bda5e003f63 /mail
parente45ead3d9b57f13128c46194a73748b5edfc7b47 (diff)
downloadgsoc2013-evolution-85df94505d91c359e1d1da2984d63ed7f6f53be8.tar.gz
gsoc2013-evolution-85df94505d91c359e1d1da2984d63ed7f6f53be8.tar.zst
gsoc2013-evolution-85df94505d91c359e1d1da2984d63ed7f6f53be8.zip
Fix the importers if you try to import into an already existing directory
svn path=/trunk/; revision=11058
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog5
-rw-r--r--mail/importers/evolution-mbox-importer.c53
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 <iain@ximian.com>
+
+ * importers/evolution-mbox-importer.c (load_file_fn): Check that the folder
+ does exist before trying to import it.
+
2001-07-12 Jeffrey Stedfast <fejj@ximian.com>
* 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){