Skip to content
This repository was archived by the owner on Jun 19, 2019. It is now read-only.

Windows paths #28

Merged
merged 2 commits into from
May 16, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/wrench.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ exports.readdirSyncRecursive = function(baseDir) {

// convert absolute paths to relative
var fileList = readdirSyncRecursive(baseDir).map(function(val){
return val.replace(baseDir + '/', '');
return _path.relative(baseDir, val);
});

return fileList;
Expand Down Expand Up @@ -106,7 +106,7 @@ exports.readdirRecursive = function(baseDir, fn) {

fn(null, curFiles.map(function(val) {
// convert absolute paths to relative
return val.replace(baseDir + '/', '');
return _path.relative(baseDir, val);
}));

if (waitCount == 0) {
Expand Down
12 changes: 6 additions & 6 deletions tests/readdir.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ function checkResult(test, files) {
var check = [
'bar.txt',
'foo',
'foo/bar',
'foo/dolor.md',
'foo/lorem.txt',
'foo/bar/ipsum.js'
path.join('foo', 'bar'),
path.join('foo', 'dolor.md'),
path.join('foo', 'lorem.txt'),
path.join('foo', 'bar', 'ipsum.js')
];

test.equals(files.length, check.length, 'number of paths is correct');
Expand All @@ -26,7 +26,7 @@ function checkResult(test, files) {

module.exports = testCase({
test_readdirSyncRecursive: function(test) {
var dir = __dirname + '/readdir';
var dir = path.join(__dirname, 'readdir');

test.ok(path.existsSync(dir), 'Folders should exist');

Expand All @@ -36,7 +36,7 @@ module.exports = testCase({
},

test_readdirRecursive: function(test) {
var dir = __dirname + '/readdir';
var dir = path.join(__dirname, 'readdir');

test.ok(path.existsSync(dir), 'Folders should exist');

Expand Down