diff --git a/lib/walk-async-only.js b/lib/walk-async-only.js index 319f5ec..41b30ca 100644 --- a/lib/walk-async-only.js +++ b/lib/walk-async-only.js @@ -7,6 +7,7 @@ function noop() {} var fs = require('fs'), + path = require('path'), EventEmitter = require('events').EventEmitter, TypeEmitter = require('./node-type-emitter'); @@ -35,7 +36,7 @@ emitter.emit('names', curpath, files, noop); files.forEachAsync(function (cont, file) { emitter.emit('name', curpath, file, noop); - fs.lstat(curpath + '/' + file, function (err, stat) { + fs.lstat(curpath + path.sep + file, function (err, stat) { stat = stat || {}; stat.name = file; if (err) { @@ -79,7 +80,7 @@ } function fullPath(v,i,o) { - o[i]= [curpath, '/', v].join(''); + o[i]= [curpath, path.sep, v].join(''); } curpath = pathname; diff --git a/lib/walk.js b/lib/walk.js index c4d3c72..fc75f8b 100644 --- a/lib/walk.js +++ b/lib/walk.js @@ -9,6 +9,7 @@ , EventEmitter = require('events').EventEmitter , TypeEmitter = require('./node-type-emitter') , util = require('util') + , path = require('path') ; function appendToDirs(stat) { @@ -95,7 +96,7 @@ me._wCurFileCallback = cont; me.emit('name', me._wcurpath, file, noop); - statPath = me._wcurpath + '/' + file; + statPath = me._wcurpath + path.sep + file; if (!me._wsync) { // TODO how to remove this anony? @@ -256,7 +257,7 @@ var me = this ; - o[i] = [me._wcurpath, '/', v].join(''); + o[i] = [me._wcurpath, path.sep, v].join(''); }; Walker.prototype.pause = function () { this._paused = true;