mirror of
https://github.com/jprichardson/node-fs-extra.git
synced 2026-01-25 16:42:57 +00:00
bugfix fs.move() moving directory across device. Closes #108
This commit is contained in:
parent
c28fff8542
commit
fbcb042b00
@ -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
|
||||
-------------------
|
||||
|
||||
16
lib/move.js
16
lib/move.js
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user