diff options
author | Guy Harris <guy@alum.mit.edu> | 2002-09-09 20:39:01 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2002-09-09 20:39:01 +0000 |
commit | 5e8ecbaf4650a35ee0c3e9240bbcedb7def95e2c (patch) | |
tree | 7000f7732a62713bbfe2090a8de2e9282043c196 /gtk/main.c | |
parent | 49425de3968d29fc8af95f349aba0164a2989b77 (diff) |
From Graeme Hewson:
Currently Ethereal sets and uses a default directory for reading
and writing, but only in some places. This set of patches extends
the setting of the default directory to the -w option as well as
the -r option, and causes all file dialogs to use and set the
default consistently. (I haven't changed the
Preferences/Printing/File dialog, though, as that's a special
case.)
There's also a fix for a bug where Ethereal was issuing the
message "Ring buffer requested, but capture isn't being saved to
a permanent file" even though a file was specified with -w.
There also appear to be some other cleanups in his patch.
svn path=/trunk/; revision=6238
Diffstat (limited to 'gtk/main.c')
-rw-r--r-- | gtk/main.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/gtk/main.c b/gtk/main.c index d014862f36..f465cc7ef3 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1,6 +1,6 @@ /* main.c * - * $Id: main.c,v 1.262 2002/09/07 10:02:29 sahlberg Exp $ + * $Id: main.c,v 1.263 2002/09/09 20:38:58 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -1729,7 +1729,7 @@ main(int argc, char *argv[]) sync_mode takes precedence; c) it makes no sense to enable the ring buffer if the maximum file size is set to "infinite". */ - if (cfile.save_file == NULL) { + if (save_file == NULL) { fprintf(stderr, "ethereal: Ring buffer requested, but capture isn't being saved to a permanent file.\n"); capture_opts.ringbuffer_on = FALSE; } @@ -1931,6 +1931,8 @@ main(int argc, char *argv[]) argument. */ s = get_dirname(cf_name); set_last_open_dir(s); + g_free(cf_name); + cf_name = NULL; } else { if (rfcode != NULL) dfilter_free(rfcode); @@ -1998,6 +2000,13 @@ main(int argc, char *argv[]) if (start_capture) { /* "-k" was specified; start a capture. */ do_capture(save_file); + if (save_file != NULL) { + /* Save the directory name for future file dialogs. */ + s = get_dirname(save_file); /* Overwrites save_file */ + set_last_open_dir(s); + g_free(save_file); + save_file = NULL; + } } else { set_menus_for_capture_in_progress(FALSE); @@ -2492,7 +2501,10 @@ set_last_open_dir(char *dirname) if (dirname) { len = strlen(dirname); - if (dirname[len-1] != G_DIR_SEPARATOR) { + if (dirname[len-1] == G_DIR_SEPARATOR) { + last_open_dir = g_strconcat(dirname, NULL); + } + else { last_open_dir = g_strconcat(dirname, G_DIR_SEPARATOR_S, NULL); } |