diff --git a/core/commandmanager.ts b/core/commandmanager.ts index a35bedd..bc0992a 100644 --- a/core/commandmanager.ts +++ b/core/commandmanager.ts @@ -169,14 +169,18 @@ export default class CommandManager { let out = []; let all = []; let diff = []; - let plugins = fs.readdirSync("./core/plugins", { withFileTypes: true, recursive: true }); - plugins = plugins.concat(fs.readdirSync("./userdata/plugins", { withFileTypes: true, recursive: true })); + let plugins = fs.readdirSync(process.cwd() +"/core/plugins", { withFileTypes: true, recursive: true }); + plugins = plugins.concat(fs.readdirSync(process.cwd() + "/userdata/plugins", { withFileTypes: true, recursive: true })); for (const i in plugins) { const plugin = plugins[i]; if (plugin && plugin.isDirectory()) { - const name = plugin.name.replaceAll("\\", "/"); - all.push(name); + const path = plugin.path.replace(process.cwd() + "/core/plugins", "").replace(process.cwd() + "/userdata/plugins", ""); + let pluginName = plugin.name.replaceAll("\\", "/"); + if (path != "") { + pluginName = (path.substring(1) +"/"+ plugin.name).replaceAll("\\", "/"); + } + all.push(pluginName); } } diff --git a/core/minicontrol.ts b/core/minicontrol.ts index 43c380a..19de59f 100644 --- a/core/minicontrol.ts +++ b/core/minicontrol.ts @@ -30,7 +30,7 @@ class MiniControl { * The version of MiniControl. */ readonly brand: string = "$n$o$eeeMINI$o$z$s$abccontrol$z$s¤white¤"; - readonly version: string = "0.3.6"; + readonly version: string = "0.3.7"; /** * The start time of MiniControl. */ @@ -356,17 +356,25 @@ class MiniControl { let include = false; const plugin = plugins[i]; include = plugin && plugin.isDirectory(); + const path = plugin.path.replace(process.cwd() + "/core/plugins", "").replace(process.cwd() + "/userdata/plugins", ""); + let pluginName = plugin.name.replaceAll("\\", "/"); + if (path != "") { + pluginName = (path.substring(1) +"/"+ plugin.name).replaceAll("\\", "/"); + } + for (const excludeName of exclude) { if (excludeName == "") continue; - if (plugin.name.replaceAll("\\", "/").startsWith(excludeName.trim())) { + if (pluginName.replaceAll("\\", "/").startsWith(excludeName.trim())) { include = false; break; } } + if (include) { - loadList.push(plugin.name.replaceAll("\\", "/")); + loadList.push(pluginName); } } + // load metadata for (const name of loadList) { const pluginName = process.cwd() + "/" + this.findPlugin(name)