From a58ea0d682533223bd0287f89b15da81ed38e515 Mon Sep 17 00:00:00 2001 From: David Murdoch Date: Tue, 5 Mar 2013 16:58:24 -0500 Subject: [PATCH 1/7] Fix typo in README.MD --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 36761ae..bba5c6e 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ The Synchronous version still uses callbacks, so it is safe to use with other As // walker = walk.walkSync("/tmp", options); walker.on("names", function (root, nodeNamesArray) { - nodeNames.sort(function (a, b) { + nodeNamesArray.sort(function (a, b) { if (a > b) return 1; if (a < b) return -1; return 0; From 09ba753b802605a50ec02d46d7f712ac80ad6804 Mon Sep 17 00:00:00 2001 From: ZECTBynmo Date: Thu, 18 Apr 2013 23:03:35 -0400 Subject: [PATCH 2/7] Add path filters to options --- lib/walk.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/walk.js b/lib/walk.js index 5209198..8e34fd8 100644 --- a/lib/walk.js +++ b/lib/walk.js @@ -35,6 +35,7 @@ me._wq = []; me._wqueue = [me._wq]; me._wcurpath = undefined; + me._wasyncFilters = options.asyncFilters; me._wfirstrun = true; me._wcurpath = pathname; @@ -187,6 +188,17 @@ var me = this ; + // Stop directories that contain filter keywords + // from continuing through the walk process + if (me._wasyncFilters != undefined) { + var shouldExclude = false; + for (var iFilter=0; iFilter Date: Thu, 18 Apr 2013 23:12:05 -0400 Subject: [PATCH 3/7] Update readme for new async filter option --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index bba5c6e..fee6bbe 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,8 @@ The Synchronous version still uses callbacks, so it is safe to use with other As options = { followLinks: false, + // asyncFilters: ["Temp", ""] // directories with these + // keys will be ignored }; walker = walk.walk("/tmp", options); From 14063d8fc3f725f14ea4f5efdd8805d22a9b0296 Mon Sep 17 00:00:00 2001 From: ZECTBynmo Date: Thu, 18 Apr 2013 23:12:58 -0400 Subject: [PATCH 4/7] Fix typo in README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fee6bbe..1a6f8a3 100644 --- a/README.md +++ b/README.md @@ -33,8 +33,8 @@ The Synchronous version still uses callbacks, so it is safe to use with other As options = { followLinks: false, - // asyncFilters: ["Temp", ""] // directories with these - // keys will be ignored + // asyncFilters: ["Temp", "_Temp"] // directories with these + // keys will be ignored }; walker = walk.walk("/tmp", options); From 6c4e267bd1d3fba861254de96d79ddbd90eba1b3 Mon Sep 17 00:00:00 2001 From: ZECTBynmo Date: Thu, 18 Apr 2013 23:13:36 -0400 Subject: [PATCH 5/7] better wording --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1a6f8a3..56d1285 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ The Synchronous version still uses callbacks, so it is safe to use with other As options = { followLinks: false, // asyncFilters: ["Temp", "_Temp"] // directories with these - // keys will be ignored + // keys will be skipped }; walker = walk.walk("/tmp", options); From 85e84a0a3f7d87c49271438f4ad10b2db52243ae Mon Sep 17 00:00:00 2001 From: ZECTBynmo Date: Sat, 20 Apr 2013 16:29:37 -0400 Subject: [PATCH 6/7] Change option name to 'filters' and implimented filtering for synchronous walking --- README.md | 4 ++-- lib/walk.js | 31 +++++++++++++++++++++++-------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 56d1285..d49e04c 100644 --- a/README.md +++ b/README.md @@ -33,8 +33,8 @@ The Synchronous version still uses callbacks, so it is safe to use with other As options = { followLinks: false, - // asyncFilters: ["Temp", "_Temp"] // directories with these - // keys will be skipped + // filters: ["Temp", "_Temp"] // directories with these + // keys will be skipped }; walker = walk.walk("/tmp", options); diff --git a/lib/walk.js b/lib/walk.js index 8e34fd8..31aabca 100644 --- a/lib/walk.js +++ b/lib/walk.js @@ -35,7 +35,7 @@ me._wq = []; me._wqueue = [me._wq]; me._wcurpath = undefined; - me._wasyncFilters = options.asyncFilters; + me._wfilters = options.filters; me._wfirstrun = true; me._wcurpath = pathname; @@ -176,12 +176,27 @@ , me = this ; - try { - files = fs.readdirSync(me._wcurpath); - } catch(e) { - err = e; + // Stop directories that contain filter keywords + // from continuing through the walk process + if (me._wfilters != undefined) { + var shouldExclude = false; + for (var iFilter=0; iFilter Date: Sat, 20 Apr 2013 16:31:36 -0400 Subject: [PATCH 7/7] Code cleanup --- lib/walk.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/walk.js b/lib/walk.js index 31aabca..e80ebf6 100644 --- a/lib/walk.js +++ b/lib/walk.js @@ -188,14 +188,12 @@ } if( !shouldExclude ) { - - console.log(me._wcurpath); try { files = fs.readdirSync(me._wcurpath); } catch(e) { err = e; } - } else console.log("excluding: " + me._wcurpath) + } me._wReaddirHandler(err, files); }; @@ -206,7 +204,6 @@ // Stop directories that contain filter keywords // from continuing through the walk process if (me._wfilters != undefined) { - var shouldExclude = false; for (var iFilter=0; iFilter