Baris Soner Usakli 11 years ago
commit 252187f1fe

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

Loading…
Cancel
Save