Comparing version 1.4.3 to 1.4.4
@@ -141,12 +141,12 @@ /* wrench.js | ||
for(var i = 0; i < files.length; i++) { | ||
var currFile = fs.lstatSync(path + "/" + files[i]); | ||
var currFile = fs.lstatSync(_path.join(path, files[i])); | ||
if(currFile.isDirectory()) // Recursive function back to the beginning | ||
exports.rmdirSyncRecursive(path + "/" + files[i]); | ||
exports.rmdirSyncRecursive(_path.join(path, files[i])); | ||
else if(currFile.isSymbolicLink()) // Unlink symlinks | ||
fs.unlinkSync(path + "/" + files[i]); | ||
fs.unlinkSync(_path.join(path, files[i])); | ||
else // Assume it's a file - perhaps a try/catch belongs here? | ||
fs.unlinkSync(path + "/" + files[i]); | ||
fs.unlinkSync(_path.join(path, files[i])); | ||
} | ||
@@ -194,3 +194,3 @@ | ||
var currFile = fs.lstatSync(sourceDir + "/" + files[i]); | ||
var currFile = fs.lstatSync(_path.join(sourceDir, files[i])); | ||
@@ -206,21 +206,21 @@ var fCopyFile = function(srcFile, destFile) { | ||
/* recursion this thing right on back. */ | ||
exports.copyDirSyncRecursive(sourceDir + "/" + files[i], newDirLocation + "/" + files[i], opts); | ||
exports.copyDirSyncRecursive(_path.join(sourceDir, files[i]), _path.join(newDirLocation, files[i]), opts); | ||
} else if(currFile.isSymbolicLink()) { | ||
var symlinkFull = fs.readlinkSync(sourceDir + "/" + files[i]); | ||
var symlinkFull = fs.readlinkSync(_path.join(sourceDir, files[i])); | ||
if (!opts.inflateSymlinks) { | ||
fs.symlinkSync(symlinkFull, newDirLocation + "/" + files[i]); | ||
if (typeof opts !== 'undefined' && !opts.inflateSymlinks) { | ||
fs.symlinkSync(symlinkFull, _path.join(newDirLocation, files[i])); | ||
continue; | ||
} | ||
var tmpCurrFile = fs.lstatSync(sourceDir + "/" + symlinkFull); | ||
var tmpCurrFile = fs.lstatSync(_path.join(sourceDir, symlinkFull)); | ||
if (tmpCurrFile.isDirectory()) { | ||
exports.copyDirSyncRecursive(sourceDir + "/" + symlinkFull, newDirLocation + "/" + files[i], opts); | ||
exports.copyDirSyncRecursive(_path.join(sourceDir, symlinkFull), _path.join(newDirLocation, files[i]), opts); | ||
} else { | ||
/* At this point, we've hit a file actually worth copying... so copy it on over. */ | ||
fCopyFile(sourceDir + "/" + symlinkFull, newDirLocation + "/" + files[i]); | ||
fCopyFile(_path.join(sourceDir, symlinkFull), _path.join(newDirLocation, files[i])); | ||
} | ||
} else { | ||
/* At this point, we've hit a file actually worth copying... so copy it on over. */ | ||
fCopyFile(sourceDir + "/" + files[i], newDirLocation + "/" + files[i]); | ||
fCopyFile(_path.join(sourceDir, files[i]), _path.join(newDirLocation, files[i])); | ||
} | ||
@@ -241,10 +241,10 @@ } | ||
for(var i = 0; i < files.length; i++) { | ||
var currFile = fs.lstatSync(sourceDir + "/" + files[i]); | ||
var currFile = fs.lstatSync(_path.join(sourceDir, files[i])); | ||
if(currFile.isDirectory()) { | ||
/* ...and recursion this thing right on back. */ | ||
exports.chmodSyncRecursive(sourceDir + "/" + files[i], filemode); | ||
exports.chmodSyncRecursive(_path.join(sourceDir, files[i]), filemode); | ||
} else { | ||
/* At this point, we've hit a file actually worth copying... so copy it on over. */ | ||
fs.chmod(sourceDir + "/" + files[i], filemode); | ||
fs.chmod(_path.join(sourceDir, files[i]), filemode); | ||
} | ||
@@ -269,10 +269,10 @@ } | ||
for(var i = 0; i < files.length; i++) { | ||
var currFile = fs.lstatSync(sourceDir + "/" + files[i]); | ||
var currFile = fs.lstatSync(_path.join(sourceDir, files[i])); | ||
if(currFile.isDirectory()) { | ||
/* ...and recursion this thing right on back. */ | ||
exports.chownSyncRecursive(sourceDir + "/" + files[i], uid, gid); | ||
exports.chownSyncRecursive(_path.join(sourceDir, files[i]), uid, gid); | ||
} else { | ||
/* At this point, we've hit a file actually worth chowning... so own it. */ | ||
fs.chownSync(sourceDir + "/" + files[i], uid, gid); | ||
fs.chownSync(_path.join(sourceDir, files[i]), uid, gid); | ||
} | ||
@@ -363,2 +363,3 @@ } | ||
var self = this; | ||
path = _path.normalize(path) | ||
@@ -369,6 +370,3 @@ try { | ||
if(err.code == "ENOENT") { | ||
var slashIdx = path.lastIndexOf("/"); | ||
if(slashIdx < 0) { | ||
slashIdx = path.lastIndexOf("\\"); | ||
} | ||
var slashIdx = path.lastIndexOf(_path.sep); | ||
@@ -375,0 +373,0 @@ if(slashIdx > 0) { |
{ | ||
"name": "wrench", | ||
"description": "Recursive filesystem (and other) operations that Node *should* have.", | ||
"version": "1.4.3", | ||
"version": "1.4.4", | ||
"author": "Ryan McGrath <ryan@venodesigns.net>", | ||
@@ -6,0 +6,0 @@ |
@@ -93,3 +93,3 @@ var testCase = require('nodeunit').testCase; | ||
test.ok(path.existsSync(dir), 'Folders should exist'); | ||
test.ok(fs.existsSync(dir), 'Folders should exist'); | ||
@@ -111,3 +111,3 @@ wrench.mkdirSyncRecursive(testdir, 0777); | ||
test.ok(path.existsSync(dir), 'Folders should exist'); | ||
test.ok(fs.existsSync(dir), 'Folders should exist'); | ||
@@ -129,3 +129,3 @@ wrench.mkdirSyncRecursive(testdir, 0777); | ||
test.ok(path.existsSync(dir), 'Folders should exist'); | ||
test.ok(fs.existsSync(dir), 'Folders should exist'); | ||
@@ -147,3 +147,3 @@ wrench.mkdirSyncRecursive(testdir, 0777); | ||
test.ok(path.existsSync(dir), 'Folders should exist'); | ||
test.ok(fs.existsSync(dir), 'Folders should exist'); | ||
@@ -166,3 +166,3 @@ wrench.mkdirSyncRecursive(testdir, 0777); | ||
test.ok(path.existsSync(dir), 'Folders should exist'); | ||
test.ok(fs.existsSync(dir), 'Folders should exist'); | ||
@@ -192,3 +192,3 @@ wrench.mkdirSyncRecursive(testdir1, 0777); | ||
test.ok(path.existsSync(dir), 'Folders should exist'); | ||
test.ok(fs.existsSync(dir), 'Folders should exist'); | ||
@@ -195,0 +195,0 @@ wrench.mkdirSyncRecursive(testdir1, 0777); |
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
27950
571