summaryrefslogtreecommitdiff
path: root/ui/gtk/file_dlg.c
diff options
context:
space:
mode:
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.
*