2008-10-11 07:35:26 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif /* HAVE_CONFIG_H */
|
|
|
|
|
2015-12-07 20:53:23 -08:00
|
|
|
#include <sys/types.h>
|
2017-11-10 13:13:06 -08:00
|
|
|
#include <direct.h>
|
|
|
|
|
2008-11-21 14:57:45 -08:00
|
|
|
#include "evil_private.h"
|
|
|
|
|
2013-06-18 23:47:20 -07:00
|
|
|
#undef rename
|
2008-10-11 07:35:26 -07:00
|
|
|
|
2017-11-10 13:13:06 -08:00
|
|
|
int
|
2013-06-18 23:47:20 -07:00
|
|
|
evil_rename(const char *src, const char* dst)
|
|
|
|
{
|
2017-11-10 13:13:06 -08:00
|
|
|
DWORD res;
|
2013-06-18 23:47:20 -07:00
|
|
|
|
2017-11-10 13:13:06 -08:00
|
|
|
res = GetFileAttributes(dst);
|
|
|
|
if ((res != 0xffffffff) && (res & FILE_ATTRIBUTE_DIRECTORY))
|
2013-06-18 23:47:20 -07:00
|
|
|
{
|
2017-11-10 13:13:06 -08:00
|
|
|
if (!RemoveDirectory(dst))
|
|
|
|
return -1;
|
2013-06-18 23:47:20 -07:00
|
|
|
}
|
|
|
|
|
2017-11-10 13:13:06 -08:00
|
|
|
return MoveFileEx(src, dst, MOVEFILE_REPLACE_EXISTING) ? 0 : -1;
|
2013-06-18 23:47:20 -07:00
|
|
|
}
|
|
|
|
|
2015-07-02 23:14:01 -07:00
|
|
|
int
|
|
|
|
evil_mkdir(const char *dirname, mode_t mode EVIL_UNUSED)
|
|
|
|
{
|
|
|
|
return _mkdir(dirname);
|
|
|
|
}
|
|
|
|
|