aboutsummaryrefslogtreecommitdiffstats
path: root/mail/importers/evolution-mbox-importer.c
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/importers/evolution-mbox-importer.c
parente45ead3d9b57f13128c46194a73748b5edfc7b47 (diff)
downloadgsoc2013-evolution-85df94505d91c359e1d1da2984d63ed7f6f53be8.tar
gsoc2013-evolution-85df94505d91c359e1d1da2984d63ed7f6f53be8.tar.gz
gsoc2013-evolution-85df94505d91c359e1d1da2984d63ed7f6f53be8.tar.bz2
gsoc2013-evolution-85df94505d91c359e1d1da2984d63ed7f6f53be8.tar.lz
gsoc2013-evolution-85df94505d91c359e1d1da2984d63ed7f6f53be8.tar.xz
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/importers/evolution-mbox-importer.c')
-rw-r--r--mail/importers/evolution-mbox-importer.c53
1 files changed, 33 insertions, 20 deletions
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){