From a1240b11a32814ac07a71c62245aad5c80c247a4 Mon Sep 17 00:00:00 2001 From: Dominik Geng Date: Wed, 27 Mar 2019 11:10:29 +0100 Subject: [PATCH] CheckPath Error -> Warn of Inode. https://github.com/jprichardson/node-fs-extra/issues/657 --- lib/copy-sync/copy-sync.js | 6 +++++- lib/copy/copy.js | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/copy-sync/copy-sync.js b/lib/copy-sync/copy-sync.js index 14ad9939..b7cc727f 100644 --- a/lib/copy-sync/copy-sync.js +++ b/lib/copy-sync/copy-sync.js @@ -182,7 +182,11 @@ function checkStats (src, dest) { function checkPaths (src, dest) { const {srcStat, destStat} = checkStats(src, dest) if (destStat.ino && destStat.ino === srcStat.ino) { - throw new Error('Source and destination must not be the same.') + console.warn( + 'Source and destination must not be the same.', + 'Dest Inode: ' + destStat.ino, + 'Src Inode: ' + srcStat.ino + ) } if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { throw new Error(`Cannot copy '${src}' to a subdirectory of itself, '${dest}'.`) diff --git a/lib/copy/copy.js b/lib/copy/copy.js index 3dfbc540..be05f6be 100644 --- a/lib/copy/copy.js +++ b/lib/copy/copy.js @@ -234,7 +234,11 @@ function checkPaths (src, dest, cb) { if (err) return cb(err) const {srcStat, destStat} = stats if (destStat.ino && destStat.ino === srcStat.ino) { - return cb(new Error('Source and destination must not be the same.')) + console.warn( + 'Source and destination must not be the same.', + 'Dest Inode: ' + destStat.ino, + 'Src Inode: ' + srcStat.ino + ) } if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { return cb(new Error(`Cannot copy '${src}' to a subdirectory of itself, '${dest}'.`))