diff options
author | Guy Harris <guy@alum.mit.edu> | 2001-10-23 05:01:02 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2001-10-23 05:01:02 +0000 |
commit | cf5a1d86e7280ec6b26a258238dd3fb3d6b31f59 (patch) | |
tree | 6b6ced95b0d95cc2f7243f2ff7546552b12f4dfa /gtk/colors.c | |
parent | 04147b7dcf4e435dab2f6aa141e0e8dec7b88b06 (diff) |
Add a new routine to create the ".ethereal" directory for a user.
Use that routine rather than duplicating that code in the routines to
write out the preference file and filter files.
Use it in the code for the color filter dialog, so that the directory in
question is created if necessary.
As that routine returns an error indication, have the code that calls
that routine put up a message box if the attempt fails.
svn path=/trunk/; revision=4065
Diffstat (limited to 'gtk/colors.c')
-rw-r--r-- | gtk/colors.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/gtk/colors.c b/gtk/colors.c index 4df4a807e9..ac29b6db79 100644 --- a/gtk/colors.c +++ b/gtk/colors.c @@ -1,7 +1,7 @@ /* colors.c * Definitions for color structures and routines * - * $Id: colors.c,v 1.12 2001/10/22 22:59:26 guy Exp $ + * $Id: colors.c,v 1.13 2001/10/23 05:01:02 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -39,6 +39,7 @@ #endif #include <epan/filesystem.h> + #include "gtk/main.h" #include "packet.h" #include "colors.h" @@ -287,9 +288,19 @@ write_filter(gpointer filter_arg, gpointer file_arg) gboolean write_filters(colfilter *filter) { + const gchar *pf_dir_path; const gchar *path; FILE *f; + /* Create the directory that holds personal configuration files, + if necessary. */ + if (create_persconffile_dir(&pf_dir_path) == -1) { + simple_dialog(ESD_TYPE_WARN, NULL, + "Can't create directory\n\"%s\"\nfor color files: %s.", + pf_dir_path, strerror(errno)); + return FALSE; + } + path = get_colorfilter_file_path(); if ((f = fopen(path, "w+")) == NULL) { simple_dialog(ESD_TYPE_CRIT, NULL, |