diff -r e1e4161a881d -r 91a208b3e979 src/gtkutils.c --- a/src/gtkutils.c Fri Jun 27 22:44:03 2003 +0000 +++ b/src/gtkutils.c Fri Jun 27 23:11:21 2003 +0000 @@ -265,7 +265,7 @@ f = gtk_file_selection_get_filename( GTK_FILE_SELECTION(gtkconv->u.im->save_icon)); - if (file_is_dir(f, GTK_FILE_SELECTION(gtkconv->u.im->save_icon))) + if (gaim_gtk_check_if_dir(f, GTK_FILE_SELECTION(gtkconv->u.im->save_icon))) return; if ((file = fopen(f, "w")) != NULL) { @@ -810,6 +810,26 @@ return optmenu; } +gboolean gaim_gtk_check_if_dir(const char *path, GtkFileSelection *filesel) +{ + struct stat st; + char *name; + + if (stat(path, &st) == 0 && S_ISDIR(st.st_mode)) { + /* append a / if needed */ + if (path[strlen(path) - 1] != '/') { + name = g_strconcat(path, "/", NULL); + } else { + name = g_strdup(path); + } + gtk_file_selection_set_filename(filesel, name); + g_free(name); + return TRUE; + } + + return FALSE; +} + char *stylize(const gchar *text, int length) { gchar *buf;