added check if target files exist on export...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-11-15 20:11:37 +03:00
parent a43f341968
commit 2045812d92

View File

@ -1929,14 +1929,22 @@ var FileSystemWriterActions = actions.Actions({
// XXX use queue for progress reporting... // XXX use queue for progress reporting...
logger && logger.emit('queued', to) logger && logger.emit('queued', to)
// XXX do we queue these or let the OS handle it??? // destination exists...
// ...needs testing, if node's fs queues the io if(fs.existsSync(to)){
// internally then we do not need to bother... logger && logger.emit('skipping', to)
queue.push(copy(from, to)
.then(function(){ // copy...
logger && logger.emit('done', to) }) } else {
.catch(function(err){ // XXX do we queue these or let the OS handle it???
logger && logger.emit('error', err) })) // ...needs testing, if node's fs queues the io
// internally then we do not need to bother...
queue.push(copy(from, to)
.then(function(){
logger && logger.emit('done', to) })
.catch(function(err){
logger && logger.emit('error', err)
}))
}
}) })
} }
}) })
@ -2098,11 +2106,17 @@ var FileSystemWriterActions = actions.Actions({
logger && logger.emit('queued', to) logger && logger.emit('queued', to)
return copy(from, to) // destination exists...
.then(function(){ if(fs.existsSync(to)){
logger && logger.emit('done', to) }) logger && logger.emit('skipping', to)
.catch(function(err){
logger && logger.emit('error', err) }) } else {
return copy(from, to)
.then(function(){
logger && logger.emit('done', to) })
.catch(function(err){
logger && logger.emit('error', err) })
}
}) })
}) })