Skip to content
Snippets Groups Projects
Commit 29b2cb05 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

CopyFile() for *nix now copies the file modification date/time too.

to mimic the behavior of the Win32 API function of the same name.
parent 8fabcdf1
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #1393 passed
...@@ -68,6 +68,7 @@ ...@@ -68,6 +68,7 @@
#include "genwrap.h" /* strupr/strlwr */ #include "genwrap.h" /* strupr/strlwr */
#include "dirwrap.h" /* DLLCALL */ #include "dirwrap.h" /* DLLCALL */
#include "filewrap.h" /* filetime() */
#if !defined(S_ISDIR) #if !defined(S_ISDIR)
#define S_ISDIR(x) ((x)&S_IFDIR) #define S_ISDIR(x) ((x)&S_IFDIR)
...@@ -1221,6 +1222,7 @@ BOOL CopyFile(const char* src, const char* dest, BOOL failIfExists) ...@@ -1221,6 +1222,7 @@ BOOL CopyFile(const char* src, const char* dest, BOOL failIfExists)
return FALSE; return FALSE;
} }
time_t ftime = filetime(fileno(in));
while(!feof(in)) { while(!feof(in)) {
size_t rd = fread(buf, sizeof(uint8_t), sizeof(buf), in); size_t rd = fread(buf, sizeof(uint8_t), sizeof(buf), in);
if(rd < 1) if(rd < 1)
...@@ -1234,6 +1236,7 @@ BOOL CopyFile(const char* src, const char* dest, BOOL failIfExists) ...@@ -1234,6 +1236,7 @@ BOOL CopyFile(const char* src, const char* dest, BOOL failIfExists)
fclose(in); fclose(in);
fclose(out); fclose(out);
setfdate(dest,ftime);
return success; return success;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment