Don't search the same plugin path twice

Fix part of #379
This commit is contained in:
Nick Farina
2015-11-04 15:50:23 -08:00
parent 8e795f48cf
commit a5de3f820f

View File

@@ -137,11 +137,18 @@ Plugin.installed = function() {
var plugins = [];
var pluginsByName = {}; // don't add duplicate plugins
var searchedPaths = {}; // don't search the same paths twice
// search for plugins among all known paths, in order
for (var index in Plugin.paths) {
var requirePath = Plugin.paths[index];
// did we already search this path?
if (searchedPaths[requirePath])
continue;
searchedPaths[requirePath] = true;
// just because this path is in require.main.paths doesn't mean it necessarily exists!
if (!fs.existsSync(requirePath))
continue;