* src/mimeview.c
authorGustavo Noronha Silva <kov@debian.org>
Mon, 13 Oct 2003 15:00:59 +0000 (15:00 +0000)
committerGustavo Noronha Silva <kov@debian.org>
Mon, 13 Oct 2003 15:00:59 +0000 (15:00 +0000)
                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.

ChangeLog.claws
src/mimeview.c

index 0f9c58d..0d90a8c 100644 (file)
@@ -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
index 063d2ef..b26273e 100644 (file)
@@ -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;