mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-09 07:25:46 +01:00
replaces fs.exists with try catch
This commit is contained in:
@@ -75,11 +75,7 @@ module.exports = function(Plugins) {
|
|||||||
|
|
||||||
var libraryPath = path.join(pluginPath, pluginData.library);
|
var libraryPath = path.join(pluginPath, pluginData.library);
|
||||||
|
|
||||||
fs.exists(libraryPath, function(exists) {
|
try {
|
||||||
if (!exists) {
|
|
||||||
return libraryNotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Plugins.libraries[pluginData.id]) {
|
if (!Plugins.libraries[pluginData.id]) {
|
||||||
Plugins.requireLibrary(pluginData.id, libraryPath);
|
Plugins.requireLibrary(pluginData.id, libraryPath);
|
||||||
}
|
}
|
||||||
@@ -91,7 +87,10 @@ module.exports = function(Plugins) {
|
|||||||
} else {
|
} else {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
});
|
} catch(err) {
|
||||||
|
winston.error(err.stack);
|
||||||
|
libraryNotFound();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapStaticDirectories(pluginData, pluginPath, callback) {
|
function mapStaticDirectories(pluginData, pluginPath, callback) {
|
||||||
|
|||||||
Reference in New Issue
Block a user