Use "g_get_tmp_dir()" to get the pathname of the temporary file
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 3 Nov 2003 22:32:36 +0000 (22:32 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 3 Nov 2003 22:32:36 +0000 (22:32 +0000)
directory.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@8872 f5534014-38df-0310-8fa8-9805f1628bb7

epan/filesystem.c

index 521ddb54ba7b515345ad6f83efe6f430be59983e..c6d7c2b606163643091f6afbc035a7cccf7ae757 100644 (file)
@@ -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;
 }