whitespace and block cleanup

This commit is contained in:
AJ ONeal 2012-01-15 20:47:08 -07:00
parent 5ea101960e
commit 042cc6d3d6
2 changed files with 27 additions and 22 deletions

View File

@ -10,5 +10,5 @@
}, },
"lib" : ".", "lib" : ".",
"main" : "./walk.js", "main" : "./walk.js",
"version" : "2.1.0" "version" : "2.1.1"
} }

View File

@ -22,16 +22,17 @@
; ;
function readdirHandler(err, files) { function readdirHandler(err, files) {
var fnodeGroups = TypeEmitter.createNodeGroups(); var fnodeGroups = TypeEmitter.createNodeGroups()
;
function filesHandler(cont, file) { function filesHandler(cont, file) {
var statPath; var statPath
;
emitter.emit('name', curpath, file, noop);
function lstatHandler(err, stat) { function lstatHandler(err, stat) {
stat = stat || {}; stat = stat || {};
stat.name = file; stat.name = file;
if (err) { if (err) {
stat.error = err; stat.error = err;
//emitter.emit('error', curpath, stat); //emitter.emit('error', curpath, stat);
@ -44,7 +45,10 @@
} }
} }
emitter.emit('name', curpath, file, noop);
statPath = curpath + '/' + file; statPath = curpath + '/' + file;
if (sync) { if (sync) {
try { try {
lstatHandler(null, fs.lstatSync(statPath)); lstatHandler(null, fs.lstatSync(statPath));
@ -90,26 +94,27 @@
} }
} }
if (err) { if (!err) {
if (!firstRun) { readFiles();
emitter.emit('directoryError', curpath, { error: err }, noop);
readFiles();
return;
}
firstRun = false;
fs.lstat(curpath, function (e, stat) {
if (stat) {
files = [curpath.replace(/.*\//, '')];
curpath = curpath.replace(files[0], '');
}
readFiles();
})
//emitter.emit('error', curpath, { error: err });
return; return;
} }
readFiles(); if (!firstRun) {
emitter.emit('directoryError', curpath, { error: err }, noop);
readFiles();
return;
}
firstRun = false;
fs.lstat(curpath, function (e, stat) {
if (stat) {
files = [curpath.replace(/.*\//, '')];
curpath = curpath.replace(files[0], '');
}
readFiles();
});
} }
function walkSync() { function walkSync() {