From: Gustavo Noronha Silva Date: Mon, 13 Oct 2003 15:00:59 +0000 (+0000) Subject: * src/mimeview.c X-Git-Tag: rel_0_9_7~94 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=332c25c7b3abf228f5a59de59034dea2fe7a3b4c;hp=4676949dc50ec5a486f835bb224df87cbcd2d2b9 * src/mimeview.c error checking when the user enters a non-directory at the file selection dialog. work-around for users entering directory location without adding a leading G_DIR_SEPARATOR. --- diff --git a/ChangeLog.claws b/ChangeLog.claws index 0f9c58d76..0d90a8cb5 100644 --- a/ChangeLog.claws +++ b/ChangeLog.claws @@ -1,3 +1,11 @@ +2003-10-13 [kov] 0.9.6claws22 + + * src/mimeview.c + error checking when the user enters a non-directory at + the file selection dialog. + work-around for users entering directory location without + adding a leading G_DIR_SEPARATOR. + 2003-10-13 [luke] 0.9.6claws21 * src/compose.c error reporting for inserting files, including catching diff --git a/src/mimeview.c b/src/mimeview.c index 063d2ef76..b26273e51 100644 --- a/src/mimeview.c +++ b/src/mimeview.c @@ -873,6 +873,24 @@ static void mimeview_save_all(MimeView *mimeview) dirname = filesel_select_file(_("Save as"), defname); if (!dirname) return; + if (!is_dir_exist (dirname)) { + alertpanel_error(_("`%s' is not a directory."), + dirname); + g_free (dirname); + return; + } + + { /* add a / after the dirname, in case the user didn't */ + gchar *dirname_tmp = NULL; + int dirname_last_char = strlen (dirname) - 1; + + if (dirname[dirname_last_char] != G_DIR_SEPARATOR) { + dirname_tmp = g_strconcat (dirname, G_DIR_SEPARATOR_S, NULL); + g_free (dirname); + dirname = dirname_tmp; + } + } + /* return to first children */ if (!partinfo->parent->children) return; /* multipart container? */ attachment = partinfo->parent->children->next;