@manidlou Looking at the code, I'm not sure I understand the meaning of the comment here:
|
// dest exists and is a regular file or directory, |
|
// Windows may throw UNKNOWN error. If dest already exists, |
|
// fs throws error anyway, so no need to guard against it here. |
|
if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlinkSync(resolvedSrc, dest) |
Is the intent that if dest exists, but can't be read, we call fs.symlinkSync in order to trigger an EEXIST error here? Assumption being that if we can't read it, we can't unlink it either?
Basically, I'm trying to make sure that it's intentional that we're just symlinking without unlinking first in this case here. LMK if there's anything I can clarify.
The same comment & logic exists in copy() as well:
|
// dest exists and is a regular file or directory, |
|
// Windows may throw UNKNOWN error. If dest already exists, |
|
// fs throws error anyway, so no need to guard against it here. |
|
if (e.code === 'EINVAL' || e.code === 'UNKNOWN') return fs.symlink(resolvedSrc, dest) |
@manidlou Looking at the code, I'm not sure I understand the meaning of the comment here:
node-fs-extra/lib/copy/copy-sync.js
Lines 143 to 146 in 353a29b
Is the intent that if
destexists, but can't be read, we callfs.symlinkSyncin order to trigger anEEXISTerror here? Assumption being that if we can't read it, we can'tunlinkit either?Basically, I'm trying to make sure that it's intentional that we're just symlinking without unlinking first in this case here. LMK if there's anything I can clarify.
The same comment & logic exists in
copy()as well:node-fs-extra/lib/copy/copy.js
Lines 150 to 153 in 353a29b