Skip to content

Commit 1a71665

Browse files
author
yibuyisheng
committed
fix fs.exists bug
1 parent 1d22dd1 commit 1a71665

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/copy.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function copySync(src, dest, filter, recursive) {
5959

6060
var stats = recursive ? fs.lstatSync(src) : fs.statSync(src)
6161
var destFolder = path.dirname(dest)
62-
var destFolderExists = fs.exists(destFolder) //<-- changing this to existsSync causes tests to fail despite the fact that existsSync is correct
62+
var destFolderExists = fs.existsSync(destFolder)
6363
var performCopy = false
6464

6565
if (stats.isFile()) {
@@ -72,7 +72,7 @@ function copySync(src, dest, filter, recursive) {
7272
}
7373
}
7474
else if (stats.isDirectory()) {
75-
if (!destFolderExists) mkdir.mkdirsSync(dest)
75+
if (!fs.existsSync(dest)) mkdir.mkdirsSync(dest)
7676
var contents = fs.readdirSync(src)
7777
contents.forEach(function(content) {
7878
copySync(path.join(src, content), path.join(dest, content), filter, true)

0 commit comments

Comments
 (0)