Check if plugin directory is a directory
This commit is contained in:
parent
d11cfbcdaa
commit
a27d586d38
|
@ -5,7 +5,7 @@
|
||||||
* https://github.com/JsSucks - https://betterdiscord.net
|
* https://github.com/JsSucks - https://betterdiscord.net
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* 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');
|
const { Module } = require('./modulebase');
|
||||||
|
@ -63,7 +63,7 @@ class Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
class PluginManager extends Module {
|
class PluginManager extends Module {
|
||||||
|
|
||||||
setInitialState() {
|
setInitialState() {
|
||||||
window.pm = this;
|
window.pm = this;
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -142,6 +142,9 @@ class PluginManager extends Module {
|
||||||
try {
|
try {
|
||||||
pluginPath = path.join(this.pluginsPath, pluginPath);
|
pluginPath = path.join(this.pluginsPath, pluginPath);
|
||||||
|
|
||||||
|
// Make sure this is a directory
|
||||||
|
await FileUtils.directoryExists(pluginPath);
|
||||||
|
|
||||||
if (!reload) {
|
if (!reload) {
|
||||||
const loaded = plugins.find(plugin => plugin.pluginPath === pluginPath);
|
const loaded = plugins.find(plugin => plugin.pluginPath === pluginPath);
|
||||||
if (loaded) {
|
if (loaded) {
|
||||||
|
@ -269,4 +272,4 @@ async function pluginManager(pluginName) {
|
||||||
if (window.bdTests) window.bdTests.pluginManager = pluginManager;
|
if (window.bdTests) window.bdTests.pluginManager = pluginManager;
|
||||||
else window.bdTests = { pluginManager };
|
else window.bdTests = { pluginManager };
|
||||||
|
|
||||||
module.exports = { PluginManager: _instance, Plugin }
|
module.exports = { PluginManager: _instance, Plugin };
|
||||||
|
|
Loading…
Reference in New Issue