+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
--------------------
Additions:
- * Add eina_list_shuffle
* Add multiple font draws support to engines
* eina :
- Add DOCTYPE children parsing in eina_simple_xml
- 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.
#include "eina_types.h"
#include "eina_array.h"
#include "eina_iterator.h"
-
+#include "eina_tmpstr.h"
/**
* @page eina_file_example_01_page
*/
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.
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;
+}