eina: add eina_file_mkstemp.
This commit is contained in:
parent
7dfa9af0f4
commit
70f8bd50eb
|
@ -1,6 +1,10 @@
|
|||
2013-03-25 Cedric Bail
|
||||
|
||||
* Eina: add portable eina_file_mkstemp().
|
||||
|
||||
2013-03-22 Jiyoun Park (Jypark)
|
||||
|
||||
* Ecore_x: fix alpha set function not clear sync counter
|
||||
* Ecore_x: fix alpha set function not clear sync counter
|
||||
|
||||
2013-03-22 Cedric Bail
|
||||
|
||||
|
|
3
NEWS
3
NEWS
|
@ -6,7 +6,6 @@ Changes since 1.7.0:
|
|||
--------------------
|
||||
|
||||
Additions:
|
||||
* Add eina_list_shuffle
|
||||
* Add multiple font draws support to engines
|
||||
* eina :
|
||||
- Add DOCTYPE children parsing in eina_simple_xml
|
||||
|
@ -21,6 +20,8 @@ Additions:
|
|||
- Add eina_stringshare_refplace()
|
||||
- Add eina_file_copy()
|
||||
- Add eina_log_print_cb_journald()
|
||||
- Add eina_list_shuffle()
|
||||
- Add eina_file_mkstemp()
|
||||
* Add Cserve2 scalecache support
|
||||
* ecore_x:
|
||||
- Add window profile support.
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "eina_types.h"
|
||||
#include "eina_array.h"
|
||||
#include "eina_iterator.h"
|
||||
|
||||
#include "eina_tmpstr.h"
|
||||
|
||||
/**
|
||||
* @page eina_file_example_01_page
|
||||
|
@ -323,6 +323,8 @@ EAPI Eina_Iterator *eina_file_stat_ls(const char *dir) EINA_WARN_UNUSED_RESULT E
|
|||
*/
|
||||
EAPI int eina_file_statat(void *container, Eina_File_Direct_Info *info, Eina_Stat *buf) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1, 2, 3);
|
||||
|
||||
EAPI int eina_file_mkstemp(const char *filename, Eina_Tmpstr **path);
|
||||
|
||||
/**
|
||||
* @brief Get an iterator to list the content of a directory, with direct
|
||||
* information.
|
||||
|
|
|
@ -569,3 +569,27 @@ eina_file_copy(const char *src, const char *dst, Eina_File_Copy_Flags flags, Ein
|
|||
|
||||
return success;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
eina_file_mkstemp(const char *filename, Eina_Tmpstr **path)
|
||||
{
|
||||
char buffer[PATH_MAX];
|
||||
const char *tmpdir;
|
||||
int fd;
|
||||
|
||||
#ifndef HAVE_EVIL
|
||||
tmpdir = getenv("TMPDIR");
|
||||
if (!tmpdir) tmpdir = "/tmp";
|
||||
#else
|
||||
tmpdir = (char *)evil_tmpdir_get();
|
||||
#endif /* ! HAVE_EVIL */
|
||||
|
||||
snprintf(buffer, PATH_MAX, "%s/%s", tmpdir, filename);
|
||||
|
||||
fd = mkstemp(buffer);
|
||||
if (path) *path = eina_tmpstr_add(buffer);
|
||||
if (fd < 0)
|
||||
return -1;
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue