aboutsummaryrefslogtreecommitdiffstats
path: root/prefs.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2001-10-24 07:18:39 +0000
committerGuy Harris <guy@alum.mit.edu>2001-10-24 07:18:39 +0000
commit509f30374efd07a3efeaa367f7f48dfae765f97e (patch)
treeef5a0eee067a920b7bbe92f3f75ae7e64d502eb5 /prefs.c
parentd453f6d99253d5946a4c150c57a7ab8bce2a0715 (diff)
Have a routine that takes a file name for a personal configuration file
and generates the path name; have it, if the file is to be opened for reading on Win32, check whether it exists and, if not, check for it in the old home directory-based configuration directory and, if so, return that path instead, so that files saved with earlier versions of Ethereal will be seen. svn path=/trunk/; revision=4072
Diffstat (limited to 'prefs.c')
-rw-r--r--prefs.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/prefs.c b/prefs.c
index 1a7833f5b8..ae81638054 100644
--- a/prefs.c
+++ b/prefs.c
@@ -1,7 +1,7 @@
/* prefs.c
* Routines for handling preferences
*
- * $Id: prefs.c,v 1.67 2001/10/23 05:00:57 guy Exp $
+ * $Id: prefs.c,v 1.68 2001/10/24 07:18:36 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -39,6 +39,8 @@
#include <unistd.h>
#endif
+#include <glib.h>
+
#include <filesystem.h>
#include "globals.h"
#include "packet.h"
@@ -595,23 +597,6 @@ print.file: /a/very/long/path/
static void read_prefs_file(const char *pf_path, FILE *pf);
-/*
- * Get the pathname of the preferences file.
- */
-static const char *
-get_preffile_path(void)
-{
- static gchar *pf_path = NULL;
-
- if (pf_path == NULL) {
- pf_path = (gchar *) g_malloc(strlen(get_persconffile_dir()) +
- strlen(PF_NAME) + 2);
- sprintf(pf_path, "%s" G_DIR_SEPARATOR_S "%s", get_persconffile_dir(),
- PF_NAME);
- }
- return pf_path;
-}
-
/* Read the preferences file, fill in "prefs", and return a pointer to it.
If we got an error (other than "it doesn't exist") trying to read
@@ -765,7 +750,7 @@ read_prefs(int *gpf_errno_return, char **gpf_path_return,
}
/* Construct the pathname of the user's preferences file. */
- pf_path = get_preffile_path();
+ pf_path = get_persconffile_path(PF_NAME, FALSE);
/* Read the user's preferences file, if it exists. */
*pf_path_return = NULL;
@@ -1466,7 +1451,7 @@ write_prefs(const char **pf_path_return)
* so that duplication can be avoided with filter.c
*/
- pf_path = get_preffile_path();
+ pf_path = get_persconffile_path(PF_NAME, TRUE);
if ((pf = fopen(pf_path, "w")) == NULL) {
*pf_path_return = pf_path;
return errno;