bugfix fs.move() moving directory across device. Closes #108

This commit is contained in:
JP Richardson 2015-01-27 23:16:39 -06:00
parent c28fff8542
commit fbcb042b00
2 changed files with 12 additions and 5 deletions

View File

@ -1,6 +1,7 @@
0.16.0 / 2015-01-**
-------------------
- bugfix `fs.move()` into itself. Closes #104
- bugfix `fs.move()` moving directory across device. Closes #108
0.15.0 / 2015-01-21
-------------------

View File

@ -77,11 +77,17 @@ function moveFileAcrossDevice(source, dest, clobber, limit, callback) {
outs.destroy()
outs.removeListener('close', onClose)
if (err.code === 'EISDIR' || err.code === 'EPERM') {
moveDirAcrossDevice(source, dest, clobber, limit, callback)
} else {
callback(err)
}
// may want to create a directory but `out` line above
// creates an empty file for us: See #108
// don't care about error here
fs.unlink(dest, function() {
// note: `err` here is from the input stream errror
if (err.code === 'EISDIR' || err.code === 'EPERM') {
moveDirAcrossDevice(source, dest, clobber, limit, callback)
} else {
callback(err)
}
})
})
outs.on('error', function(err) {