commit 949d954de20d892357c7b77e522ee8f677f3cfda
parent a3b1297860ea51dc635f40b68287c36ae1a2a4a8
Author: gearsix <gearsix@tuta.io>
Date: Sat, 19 Mar 2022 16:55:37 +0000
copy.go: filemod time is also checked to see if a file is to be copied
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/copy.go b/copy.go
@@ -32,6 +32,7 @@ int copyf(const char *src, const char *dst)
total += w;
}
} while (!feof(srcf));
+
if (total == siz) ret = EXIT_SUCCESS;
ABORT:
@@ -71,8 +72,9 @@ func CopyFile(src, dst string) (err error) {
return err
}
- // only copy if dst doesnt exist or has different name/size
- if dstfi == nil || srcfi.Name() == dstfi.Name() && srcfi.Size() == dstfi.Size() {
+ // only copy if dst doesnt exist or has different name/size/modtime
+ if dstfi == nil || srcfi.Name() != dstfi.Name() ||
+ srcfi.Size() != dstfi.Size() || srcfi.ModTime() != dstfi.ModTime() {
cSrc := C.CString(src)
cDst := C.CString(dst)
if uint32(C.copyf(cSrc, cDst)) != 0 {