mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 19:46:01 +01:00
closes #455
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user