#include <stdio.h> /* fprintf */
#include <sys/types.h> /* stat, utime */
#include <sys/stat.h> /* stat */
-#include <utime.h> /* utime */
+#if defined(_MSC_VER)
+ #include <sys/utime.h> /* utime */
+ #include <io.h> /* _chmod */
+#else
+ #include <unistd.h> /* chown, stat */
+ #include <utime.h> /* utime */
+#endif
#include <time.h> /* time */
-#include <unistd.h> /* chown, stat */
+#include <errno.h>
#include "mem.h" /* U32, U64 */
* File functions
******************************************/
#if defined(_MSC_VER)
- typedef struct _stat64 stat_t;
+ #define chmod _chmod
+ typedef struct _stat64 stat_t;
#else
typedef struct stat stat_t;
#endif
int res = 0;
struct utimbuf timebuf;
+ timebuf.actime = time(NULL);
+ timebuf.modtime = statbuf->st_mtime;
+ res += utime(filename, &timebuf); /* set access and modification times */
+
#if !defined(_WIN32)
res += chown(filename, statbuf->st_uid, statbuf->st_gid); /* Copy ownership */
#endif
res += chmod(filename, statbuf->st_mode & 07777); /* Copy file permissions */
- timebuf.actime = time(NULL);
- timebuf.modtime = statbuf->st_mtime;
- res += utime(filename, &timebuf); /* set access and modification times */
-
errno = 0;
return -res; /* number of errors is returned */
}
((defined(__unix__) || defined(__unix) || defined(__midipix__)) && defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L)) /* snprintf, opendir */
# define UTIL_HAS_CREATEFILELIST
# include <dirent.h> /* opendir, readdir */
-# include <errno.h>
UTIL_STATIC int UTIL_prepareFileList(const char *dirName, char** bufStart, size_t* pos, char** bufEnd)
{