aboutsummaryrefslogtreecommitdiffstats
path: root/epan/filesystem.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2003-11-03 22:32:36 +0000
committerGuy Harris <guy@alum.mit.edu>2003-11-03 22:32:36 +0000
commitd2db02c521790d606b7ac5590daa64a4f96da8aa (patch)
tree9cfb67e5fd6f0149f1c0dadca72ce0b580d9ef1a /epan/filesystem.c
parent85773d34c3c509fa6e72f25296e8d5cc6f70af76 (diff)
Use "g_get_tmp_dir()" to get the pathname of the temporary file
directory. svn path=/trunk/; revision=8872
Diffstat (limited to 'epan/filesystem.c')
-rw-r--r--epan/filesystem.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/epan/filesystem.c b/epan/filesystem.c
index 521ddb54ba..c6d7c2b606 100644
--- a/epan/filesystem.c
+++ b/epan/filesystem.c
@@ -1,7 +1,7 @@
/* filesystem.c
* Filesystem utility routines
*
- * $Id: filesystem.c,v 1.26 2003/11/03 02:41:07 gerald Exp $
+ * $Id: filesystem.c,v 1.27 2003/11/03 22:32:36 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -630,24 +630,15 @@ deletefile(const char *path)
/*
* Construct and return the path name of a file in the
- * $TMP/%TEMP% directory.
+ * appropriate temporary file directory.
*/
char *get_tempfile_path(const char *filename)
{
- char *path, *dir, *def;
-
-#ifdef WIN32
- dir = getenv("TEMP");
- def = "C:\\";
-#else
- dir = getenv("TMP");
- def = "/tmp";
-#endif
- if (!dir || (dir = get_dirname(dir)) == NULL)
- dir = def;
+ char *path;
- path = (gchar *) g_malloc(strlen(dir) + strlen(filename) + 2);
- sprintf(path, "%s" G_DIR_SEPARATOR_S "%s", dir, filename);
+ path = (gchar *) g_malloc(strlen(g_get_tmp_dir()) +
+ strlen(filename) + 2);
+ sprintf(path, "%s" G_DIR_SEPARATOR_S "%s", g_get_tmp_dir(), filename);
return path;
}