Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Commit

Permalink
bootstrap: drop unneeded "customCopyFile"
Browse files Browse the repository at this point in the history
  • Loading branch information
jesec committed Feb 3, 2022
1 parent 9fc04ab commit ed29344
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions prelude/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,19 +179,7 @@ function copyInChunks(
fs_.closeSync(targetFile);
}

function customCopyFile(source, target, chunkSize) {
let targetFile = target;

// If target is a directory, a new file with the same name will be created
if (fs.existsSync(target)) {
if (fs.lstatSync(target).isDirectory()) {
targetFile = path.join(target, path.basename(source));
}
}

copyInChunks(source, targetFile, chunkSize);
}

// TODO: replace this with fs.cpSync when we drop Node < 16
function copyFolderRecursiveSync(source, target) {
let files = [];

Expand All @@ -209,7 +197,10 @@ function copyFolderRecursiveSync(source, target) {
if (fs.lstatSync(curSource).isDirectory()) {
copyFolderRecursiveSync(curSource, targetFolder);
} else {
customCopyFile(curSource, targetFolder);
fs.copyFileSync(
curSource,
path.join(targetFolder, path.basename(curSource))
);
}
});
}
Expand Down

0 comments on commit ed29344

Please sign in to comment.