From af439310084e6c16105d1454ffaa1f99ea8639eb Mon Sep 17 00:00:00 2001 From: Miki Date: Wed, 30 Nov 2022 15:19:06 -0800 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 Signed-off-by: David Sinclair --- CHANGELOG.md | 1 + src/dev/build/lib/scan_copy.ts | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a208b4f1f40..74fd96710709 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -69,6 +69,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Temporary workaround for task-kill exceptions on Windows when it is passed a pid for a process that is already dead ([#2842](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2842)) - [Vis Builder] Fix empty workspace animation does not work in firefox ([#2853](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2853)) - Bumped `del` version to fix MacOS race condition ([#2847](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2873)) +- [Build] Fixed "Last Access Time" not being set by `scanCopy` on Windows ([#2964](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2964)) ### 🚞 Infrastructure diff --git a/src/dev/build/lib/scan_copy.ts b/src/dev/build/lib/scan_copy.ts index f467c0fca257..2bc63a654c0d 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);