From a27d586d38230b2e145dde1a8f4694daa251af1c Mon Sep 17 00:00:00 2001 From: Samuel Elliott Date: Thu, 25 Jan 2018 16:49:02 +0000 Subject: [PATCH] Check if plugin directory is a directory --- client/src/modules/core/pluginmanager.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/client/src/modules/core/pluginmanager.js b/client/src/modules/core/pluginmanager.js index 1c3d9fc6..bd6e4a9f 100644 --- a/client/src/modules/core/pluginmanager.js +++ b/client/src/modules/core/pluginmanager.js @@ -5,7 +5,7 @@ * https://github.com/JsSucks - https://betterdiscord.net * * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * LICENSE file in the root directory of this source tree. */ const { Module } = require('./modulebase'); @@ -63,7 +63,7 @@ class Plugin { } class PluginManager extends Module { - + setInitialState() { window.pm = this; this.setState({ @@ -142,6 +142,9 @@ class PluginManager extends Module { try { pluginPath = path.join(this.pluginsPath, pluginPath); + // Make sure this is a directory + await FileUtils.directoryExists(pluginPath); + if (!reload) { const loaded = plugins.find(plugin => plugin.pluginPath === pluginPath); if (loaded) { @@ -269,4 +272,4 @@ async function pluginManager(pluginName) { if (window.bdTests) window.bdTests.pluginManager = pluginManager; else window.bdTests = { pluginManager }; -module.exports = { PluginManager: _instance, Plugin } \ No newline at end of file +module.exports = { PluginManager: _instance, Plugin };