Skip to content

Commit

Permalink
add check-source-exist case
Browse files Browse the repository at this point in the history
  • Loading branch information
Soi4An committed Jan 27, 2024
1 parent a319c8a commit 3a4b6b2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ switch (true) {
case (sourceFile === destinationFile):
break;

case !fs.existsSync(sourceFile):
console.error('The source is not exist');
break;

default: {
try {
fs.cpSync(sourceFile, destinationFile);
Expand Down

0 comments on commit 3a4b6b2

Please sign in to comment.