Skip to content
This repository has been archived by the owner on Jun 19, 2019. It is now read-only.

Commit

Permalink
Bit of args switching to keep old users in running order
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan McGrath committed May 3, 2013
1 parent 04c8fe0 commit c8475a1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/wrench.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,14 @@ exports.chownSyncRecursive = function(sourceDir, uid, gid) {
*
* Recursively dives through directories and obliterates everything about it.
*/
exports.rmdirRecursive = function rmdirRecursive(dir, clbk){
exports.rmdirRecursive = function rmdirRecursive(dir, failSilent, clbk){
fs.readdir(dir, function(err, files){
if (err) return clbk(err);
if(err && typeof failSilent === 'boolean' && !failSilent)
return clbk(err);

if(typof failSilent === 'function')
clbk = failSilent;

(function rmFile(err){
if (err) return clbk(err);

Expand Down Expand Up @@ -328,6 +333,9 @@ exports.copyDirRecursive = function copyDirRecursive(srcDir, newDir, opts, clbk)
return clbk(new Error('You are trying to delete a directory that already exists. Specify forceDelete in an options object to override this.'));
}

if(typeof opts === 'function')
clbk = opts;

fs.stat(srcDir, function(err, srcDirStat){
if (err) return clbk(err);
fs.mkdir(newDir, srcDirStat.mode, function(err){
Expand Down

0 comments on commit c8475a1

Please sign in to comment.