v1.18.x
Julian Lam 11 years ago
parent fba1f7ae05
commit 97c5f6009d

@ -232,32 +232,13 @@ var fs = require('fs'),
}); });
}, },
showInstalled: function(callback) { showInstalled: function(callback) {
// TODO: Also check /node_modules
var _self = this; var _self = this;
localPluginPath = path.join(__dirname, '../plugins'),
npmPluginPath = path.join(__dirname, '../node_modules'); npmPluginPath = path.join(__dirname, '../node_modules');
async.waterfall([ async.waterfall([
function(next) { function(next) {
async.parallel([ fs.readdir(npmPluginPath, function(err, dirs) {
function(next) { dirs = dirs.map(function(file) {
fs.readdir(localPluginPath, next);
},
function(next) {
fs.readdir(npmPluginPath, next);
}
], function(err, dirs) {
if (err) return next(err);
dirs[0] = dirs[0].map(function(file) {
return path.join(localPluginPath, file);
}).filter(function(file) {
var stats = fs.statSync(file);
if (stats.isDirectory()) return true;
else return false;
});
dirs[1] = dirs[1].map(function(file) {
return path.join(npmPluginPath, file); return path.join(npmPluginPath, file);
}).filter(function(file) { }).filter(function(file) {
var stats = fs.statSync(file); var stats = fs.statSync(file);
@ -265,7 +246,7 @@ var fs = require('fs'),
else return false; else return false;
}); });
next(err, dirs[0].concat(dirs[1])); next(err, dirs);
}); });
}, },
function(files, next) { function(files, next) {

Loading…
Cancel
Save