Skip to content
Snippets Groups Projects
Unverified Commit f5565dd6 authored by Timothy Carambat's avatar Timothy Carambat Committed by GitHub
Browse files

Patch missing folder autogenerate for plugins (#2273)

parent de9f9a0c
No related branches found
No related tags found
No related merge requests found
...@@ -45,6 +45,15 @@ class ImportedPlugin { ...@@ -45,6 +45,15 @@ class ImportedPlugin {
return true; return true;
} }
/**
* Checks if the plugin folder exists and if it does not, creates the folder.
*/
static checkPluginFolderExists() {
const dir = path.resolve(pluginsPath);
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
return;
}
/** /**
* Loads plugins from `plugins` folder in storage that are custom loaded and defined. * Loads plugins from `plugins` folder in storage that are custom loaded and defined.
* only loads plugins that are active: true. * only loads plugins that are active: true.
...@@ -52,6 +61,7 @@ class ImportedPlugin { ...@@ -52,6 +61,7 @@ class ImportedPlugin {
*/ */
static async activeImportedPlugins() { static async activeImportedPlugins() {
const plugins = []; const plugins = [];
this.checkPluginFolderExists();
const folders = fs.readdirSync(path.resolve(pluginsPath)); const folders = fs.readdirSync(path.resolve(pluginsPath));
for (const folder of folders) { for (const folder of folders) {
const configLocation = path.resolve( const configLocation = path.resolve(
...@@ -72,6 +82,7 @@ class ImportedPlugin { ...@@ -72,6 +82,7 @@ class ImportedPlugin {
*/ */
static listImportedPlugins() { static listImportedPlugins() {
const plugins = []; const plugins = [];
this.checkPluginFolderExists();
if (!fs.existsSync(pluginsPath)) return plugins; if (!fs.existsSync(pluginsPath)) return plugins;
const folders = fs.readdirSync(path.resolve(pluginsPath)); const folders = fs.readdirSync(path.resolve(pluginsPath));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment