summaryrefslogtreecommitdiff
path: root/ui/gtk/file_dlg.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2012-06-04 19:37:04 +0000
committerGuy Harris <guy@alum.mit.edu>2012-06-04 19:37:04 +0000
commit5caadafaca39e13a58c7dbe48344aa7da92f81dc (patch)
tree9dc461caa20e9d211edc701dc190cc4768b0fc8e /ui/gtk/file_dlg.c
parent0955936403be216fafa1441383c4614218cdb12c (diff)
downloadwireshark-5caadafaca39e13a58c7dbe48344aa7da92f81dc.tar.gz
And do the same with the color filter import and export dialogs (which
really don't belong here - they have nothing to do with capture files). Absorb the test for the target file's existence into file_target_exist_ui(). svn path=/trunk/; revision=43077
Diffstat (limited to 'ui/gtk/file_dlg.c')
-rw-r--r--ui/gtk/file_dlg.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/ui/gtk/file_dlg.c b/ui/gtk/file_dlg.c
index 5e149c1f98..db0a1012e7 100644
--- a/ui/gtk/file_dlg.c
+++ b/ui/gtk/file_dlg.c
@@ -32,6 +32,10 @@
#include <wsutil/file_util.h>
+#ifndef _WIN32
+#include <epan/filesystem.h>
+#endif
+
#include "ui/gtk/gtkglobals.h"
#include "ui/gtk/gui_utils.h"
#include "ui/gtk/file_dlg.h"
@@ -154,9 +158,11 @@ file_selection_set_extra_widget(GtkWidget *fs, GtkWidget *extra)
}
#ifndef _WIN32
-/* Pop up and run the UI asking the user whether they want to
- overwrite a file and, if it's user-immutable or not writable,
- whether they want to overwrite it anyway. */
+/* If the specified file doesn't exist, return TRUE.
+ If it does exist, pop up and run the UI asking the user whether
+ they want to overwrite a file and, if it's user-immutable or not
+ writable, whether they want to overwrite it anyway, and return
+ TRUE if the file should be overwritten and FALSE otherwise. */
gboolean
file_target_exist_ui(GtkWidget *chooser_w, char *cf_name)
{
@@ -165,6 +171,11 @@ file_target_exist_ui(GtkWidget *chooser_w, char *cf_name)
gint response;
ws_statb64 statbuf;
+ if (!file_exists(cf_name)) {
+ /* The target doesn't exist; don't bother the user. */
+ return TRUE;
+ }
+
/*
* The file exists. Ask the user if they want to overwrite it.
*