Don't actually load disabled plugins lol

This commit is contained in:
Mm2PL 2023-02-01 17:30:09 +01:00
parent 8665d22f48
commit cf9e5ed66c
No known key found for this signature in database
GPG key ID: 94AC9B80EFA15ED9

View file

@ -140,6 +140,7 @@ void PluginController::load(QFileInfo index, QDir pluginDir, PluginMeta meta)
auto pluginName = pluginDir.dirName(); auto pluginName = pluginDir.dirName();
auto plugin = std::make_unique<Plugin>(pluginName, l, meta, pluginDir); auto plugin = std::make_unique<Plugin>(pluginName, l, meta, pluginDir);
for (const auto &[codename, other] : this->plugins_) for (const auto &[codename, other] : this->plugins_)
{ {
if (other->meta.name == meta.name) if (other->meta.name == meta.name)
@ -148,8 +149,13 @@ void PluginController::load(QFileInfo index, QDir pluginDir, PluginMeta meta)
other->isDupeName = true; other->isDupeName = true;
} }
} }
this->plugins_.insert({pluginName, std::move(plugin)}); this->plugins_.insert({pluginName, std::move(plugin)});
if (!this->isEnabled(pluginName))
{
qCInfo(chatterinoLua) << "Skipping loading" << pluginName << "("
<< meta.name << ") because it is disabled";
return;
}
int err = luaL_dofile(l, index.absoluteFilePath().toStdString().c_str()); int err = luaL_dofile(l, index.absoluteFilePath().toStdString().c_str());
if (err != 0) if (err != 0)