This commit is contained in:
monkadd 2013-05-04 13:28:53 -07:00
commit 35514fe732

View file

@ -188,10 +188,10 @@ exports.copyDirSyncRecursive = function(sourceDir, newDirLocation, opts) {
for(var i = 0; i < files.length; i++) {
// ignores all files or directories which match the RegExp in opts.filter
if(typeof opts !== 'undefined') {
if(typeof opts !== 'undefined') {
if(!opts.whitelist && opts.filter && files[i].match(opts.filter)) continue;
// if opts.whitelist is true every file or directory which doesn't match opts.filter will be ignored
if(opts.whitelist && opts.filter && !files[i].match(opts.filter)) continue;
// if opts.whitelist is true every file or directory which doesn't match opts.filter will be ignored
if(opts.whitelist && opts.filter && !files[i].match(opts.filter)) continue;
if (opts.excludeHiddenUnix && /^\./.test(files[i])) continue;
}
@ -199,6 +199,8 @@ exports.copyDirSyncRecursive = function(sourceDir, newDirLocation, opts) {
var fCopyFile = function(srcFile, destFile) {
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);
fs.writeFileSync(destFile, contents);