From 6f007430ce93a380437a78716a3f1eb61f5540e9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 30 Nov 2022 23:21:29 +0000 Subject: [PATCH] Fixes folder timestamps being updated before copying files into them (#2964) * When updating the timestamps were requested, scanCopy first set the times and then copied content into the destination folder. On certain platforms, copying files into a folder updates its "Last Access Time" and that overwrites the just set timestamps. This PR, makes sure the timestamps are set only after copying the content. Signed-off-by: Miki Signed-off-by: Miki (cherry picked from commit 5dc0212c7748fd4b8b23a9c5f5843906dc9529c5) Signed-off-by: github-actions[bot] # Conflicts: # CHANGELOG.md --- src/dev/build/lib/scan_copy.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dev/build/lib/scan_copy.ts b/src/dev/build/lib/scan_copy.ts index f467c0fca25..2bc63a654c0 100644 --- a/src/dev/build/lib/scan_copy.ts +++ b/src/dev/build/lib/scan_copy.ts @@ -107,13 +107,13 @@ export async function scanCopy(options: Options) { await copyFileAsync(record.absolute, record.absoluteDest, Fs.constants.COPYFILE_EXCL); } - if (time) { - await utimesAsync(record.absoluteDest, time, time); - } - if (record.isDirectory) { await copyChildren(record); } + + if (time) { + await utimesAsync(record.absoluteDest, time, time); + } }; await mkdirp(destination);