Skip to content

Commit 22bf305

Browse files
committed
Fix glob.sync throwing when it can't access a directory apidoc#43
1 parent c1c3cdf commit 22bf305

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

lib/plugin_loader.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
var _ = require('lodash');
2-
var fs = require('fs');
32
var path = require('path');
43
var util = require('util');
54
var glob = require('glob');
@@ -44,19 +43,15 @@ module.exports = PluginLoader;
4443
PluginLoader.prototype.detectPugins = function(dir) {
4544
var self = this;
4645

46+
// Every dir start with "apidoc-plugin-", because for the tests of apidoc-plugin-test.
47+
var plugins;
4748
try {
48-
if (dir === '/') {
49-
fs.accessSync(dir + '.');
50-
} else {
51-
fs.accessSync(dir + '/.');
52-
}
49+
plugins = glob.sync(dir + '/apidoc-plugin-*');
5350
} catch (e) {
5451
app.log.warn(e);
5552
return;
5653
}
5754

58-
// Every dir start with "apidoc-plugin-", because for the tests of apidoc-plugin-test.
59-
var plugins = glob.sync(dir + '/apidoc-plugin-*');
6055
if (plugins.length === 0) {
6156
dir = path.join(dir, '..');
6257
if (dir === '/' || dir.substr(1) === ':\\') {

0 commit comments

Comments
 (0)