Skip to content

Commit f3a38e5

Browse files
committed
Bugfix normalize directory handling (klaw-sync 1.1 update).
1 parent 62c90c8 commit f3a38e5

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

lib/utils/find_files.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
var fs = require('fs-extra');
22
var klawSync = require('klaw-sync');
33
var os = require('os');
4+
var path = require('path');
45

56
var FileError = require('../errors/file_error');
67

78
/**
89
* Search files recursivly and filter with include / exlude filters
910
*/
1011
function FindFiles() {
11-
this.path = './';
12+
this.path = process.cwd();
1213
this.excludeFilters = [];
1314
this.includeFilters = [];
1415
}
@@ -23,9 +24,9 @@ module.exports = new FindFiles();
2324
*
2425
* @param {String} path
2526
*/
26-
FindFiles.prototype.setPath = function(path) {
27+
FindFiles.prototype.setPath = function(newPath) {
2728
if (path) {
28-
this.path = path;
29+
this.path = path.resolve(newPath);
2930
}
3031
};
3132

@@ -59,6 +60,7 @@ FindFiles.prototype.setIncludeFilters = function(includeFilters) {
5960
FindFiles.prototype.search = function() {
6061
var self = this;
6162
var files = [];
63+
6264
try {
6365
files = klawSync(self.path).map( function(entry) {
6466
return entry.path;
@@ -136,14 +138,12 @@ FindFiles.prototype.search = function() {
136138
}
137139

138140
// remove source path prefix
139-
if (self.path !== './') {
140-
files = files.map( function(filename) {
141-
if (filename.startsWith(self.path)) {
142-
return filename.substr(self.path.length + 1); // + 1 / at the end
143-
}
144-
return filename;
145-
});
146-
}
141+
files = files.map( function(filename) {
142+
if (filename.startsWith(self.path)) {
143+
return filename.substr(self.path.length + 1);
144+
}
145+
return filename;
146+
});
147147
}
148148
return files;
149149
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "apidoc-core",
3-
"version": "0.8.1",
3+
"version": "0.8.2",
44
"description": "Core parser library to generate apidoc result following the apidoc-spec",
55
"author": "Peter Rottmann <rottmann@inveris.de>",
66
"license": "MIT",

0 commit comments

Comments
 (0)