Skip to content

Commit

Permalink
Fixes folder timestamps being updated before copying files into them (#…
Browse files Browse the repository at this point in the history
…2964) (#2976)

* 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 <amoo_miki@yahoo.com>

Signed-off-by: Miki <amoo_miki@yahoo.com>
(cherry picked from commit 5dc0212)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent f9bffcb commit 9b56327
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/dev/build/lib/scan_copy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,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);
Expand Down

0 comments on commit 9b56327

Please sign in to comment.