Comparing version 1.5.4 to 1.5.5
@@ -15,3 +15,4 @@ /* wrench.js | ||
var fs = require("fs"), | ||
_path = require("path"); | ||
_path = require("path"), | ||
isWindows = !!process.platform.match(/^win/); | ||
@@ -126,3 +127,3 @@ /* wrench.readdirSyncRecursive("directory_path"); | ||
/* wrench.rmdirSyncRecursive("directory_path", forceDelete, failSilent); | ||
/* wrench.rmdirSyncRecursive("directory_path", failSilent); | ||
* | ||
@@ -139,2 +140,3 @@ * Recursively dives through directories and obliterates everything about it. This is a | ||
} catch (err) { | ||
if(failSilent) return; | ||
@@ -146,12 +148,23 @@ throw new Error(err.message); | ||
for(var i = 0; i < files.length; i++) { | ||
var currFile = fs.lstatSync(_path.join(path, files[i])); | ||
var file = _path.join(path, files[i]); | ||
var currFile = fs.lstatSync(file); | ||
if(currFile.isDirectory()) // Recursive function back to the beginning | ||
exports.rmdirSyncRecursive(_path.join(path, files[i])); | ||
if(currFile.isDirectory()) { | ||
// Recursive function back to the beginning | ||
exports.rmdirSyncRecursive(file); | ||
} else if(currFile.isSymbolicLink()) { | ||
// Unlink symlinks | ||
if (isWindows) { | ||
fs.chmodSync(file, 666) // Windows needs this unless joyent/node#3006 is resolved.. | ||
} | ||
else if(currFile.isSymbolicLink()) // Unlink symlinks | ||
fs.unlinkSync(_path.join(path, files[i])); | ||
fs.unlinkSync(file); | ||
} else { | ||
// Assume it's a file - perhaps a try/catch belongs here? | ||
if (isWindows) { | ||
fs.chmodSync(file, 666) // Windows needs this unless joyent/node#3006 is resolved.. | ||
} | ||
else // Assume it's a file - perhaps a try/catch belongs here? | ||
fs.unlinkSync(_path.join(path, files[i])); | ||
fs.unlinkSync(file); | ||
} | ||
} | ||
@@ -158,0 +171,0 @@ |
{ | ||
"name": "wrench", | ||
"description": "Recursive filesystem (and other) operations that Node *should* have.", | ||
"version": "1.5.4", | ||
"version": "1.5.5", | ||
"author": "Ryan McGrath <ryan@venodesigns.net>", | ||
@@ -6,0 +6,0 @@ |
@@ -7,3 +7,4 @@ // `nodeunit tests/runner` | ||
group_readdir: require('./readdir'), | ||
group_copydir: require('./copydirsync_unix') | ||
group_copydir: require('./copydirsync_unix'), | ||
group_rmdir: require('./rmdirSyncRecursive') | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36147
21
712
5