Move get_tempfile_path() from filesystem.[ch] to tempfile.[ch].

svn path=/trunk/; revision=53379
This commit is contained in:
Guy Harris 2013-11-17 04:39:44 +00:00
parent 74647a318b
commit eee9b9ddd3
5 changed files with 20 additions and 21 deletions

View File

@ -71,12 +71,13 @@
#include <wsutil/report_err.h>
#include <wsutil/file_util.h>
#include <wsutil/filesystem.h>
#include <wsutil/tempfile.h>
#include <epan/packet.h>
#include <epan/exceptions.h>
#include <epan/addr_resolv.h>
#include <epan/prefs.h>
#include <wsutil/filesystem.h>
#include <epan/dissectors/packet-tcp.h>
#include <epan/oids.h>
#include <epan/emem.h>

View File

@ -1895,15 +1895,6 @@ deletefile(const char *path)
return ws_unlink(path) == 0;
}
/*
* Construct and return the path name of a file in the
* appropriate temporary file directory.
*/
char *get_tempfile_path(const char *filename)
{
return g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", g_get_tmp_dir(), filename);
}
/*
* Return an error message for UNIX-style errno indications on open or
* create operations.

View File

@ -204,14 +204,6 @@ WS_DLL_PUBLIC char *get_persconffile_path(const char *filename, gboolean from_pr
*/
WS_DLL_PUBLIC const char *get_persdatafile_dir(void);
/*
* Construct the path name of a file in $TMP/%TEMP% directory.
* Or "/tmp/<filename>" (C:\<filename>) if that fails.
*
* Return value is g_malloced so the caller should g_free it.
*/
WS_DLL_PUBLIC char *get_tempfile_path(const char *filename);
/*
* process command line option belonging to the filesystem settings
*/

View File

@ -146,6 +146,15 @@ mkdtemp (char *template)
#endif /* HAVE_MKDTEMP */
/*
* Construct and return the path name of a file in the
* appropriate temporary file directory.
*/
char *get_tempfile_path(const char *filename)
{
return g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", g_get_tmp_dir(), filename);
}
#define MAX_TEMPFILES 3
/**
@ -200,9 +209,6 @@ create_tempfile(char **namebuf, const char *pfx)
tf[idx].path = (char *)g_malloc(tf[idx].len);
}
/*
* We can't use get_tempfile_path here because we're called from dumpcap.c.
*/
tmp_dir = g_get_tmp_dir();
#ifdef _WIN32

View File

@ -35,6 +35,15 @@ extern "C" {
* Convenience function for temporary file creation.
*/
/**
* Construct the path name of a file in the appropriate temporary
* file directory.
*
* @param filename the file name to be given to the file.
* @return the pathname of the file, g_malloced so the caller
* should g_free it.
*/
WS_DLL_PUBLIC char *get_tempfile_path(const char *filename);
/**
* Create a tempfile with the given prefix (e.g. "wireshark"). The path