* Evas: optimized path for when map use the same color for all corner.
+2013-06-19 Christophe Sadoine
+
+ * Evil: Added evil_rename function, a wrapper around rename().
+
2013-06-18 Cedric Bail
* Evas: Use Eo array of callbacks to reduce edje memory foot print of Evas_Object_Box and Evas_Object_Table.
* Add --with-api=XXX (both|legacy|eo)
* Evil:
- Add mkdtemp.
+ - Add evil_rename() a wrapper for rename().
* eina:
- Add DOCTYPE children parsing in eina_simple_xml
- Add eina_barrier thread API
#include "evil_private.h"
#undef fopen
-
+#undef rename
#ifdef _WIN32_WCE
}
#endif /* _WIN32_WCE */
+
+int
+evil_rename(const char *src, const char* dst)
+{
+ struct stat st;
+
+ if (stat(dst, &st) < 0)
+ return rename(src, dst);
+
+ if (stat(src, &st) < 0)
+ return -1;
+
+ if (S_ISDIR(st.st_mode))
+ {
+ rmdir(dst);
+ return rename(src, dst);
+ }
+
+ if (S_ISREG(st.st_mode))
+ {
+ unlink(dst);
+ return rename(src, dst);
+ }
+
+ return -1;
+}
+
/**
- * @}
+ * @brief Emulate the rename() function on Windows.
+ *
+ * @param src The old pathname.
+ * @param dst The new pathname.
+ * @return 0 on success, -1 otherwise.
+ *
+ * This function emulates the POSIX rename() function on Windows.
+ * The difference with the POSIX function is that the rename() function
+ * on windows fails if the destination exists.
+ *
+ * @since 1.8
+ */
+EAPI int evil_rename(const char *src, const char *dst);
+
+/**
+ * @def rename(src, dest)
+ *
+ * Wrapper around evil_rename().
*/
+# define rename(src, dst) evil_rename(src, dst)
#endif /* __EVIL_STDIO_H__ */