Add option to ignore files

Add one more attribute to param 'opts' to ignore the files when run
directory copy synchronously.
This commit is contained in:
monk.add 2013-04-18 11:33:25 +08:00
parent b70e1b1fb6
commit 5c0831ef43

View file

@ -194,6 +194,8 @@ exports.copyDirSyncRecursive = function(sourceDir, newDirLocation, opts) {
var fCopyFile = function(srcFile, destFile) { var fCopyFile = function(srcFile, destFile) {
if(typeof opts !== 'undefined' && opts.preserveFiles && fs.existsSync(destFile)) return; if(typeof opts !== 'undefined' && opts.preserveFiles && fs.existsSync(destFile)) return;
// if opts.ignoreFiles is true every file will be ignored
if(typeof opts !== 'undefined' && opts.ignoreFiles) return;
var contents = fs.readFileSync(srcFile); var contents = fs.readFileSync(srcFile);
fs.writeFileSync(destFile, contents); fs.writeFileSync(destFile, contents);