diff --git a/PluginManager.cpp b/PluginManager.cpp index d900f7d4..d201edae 100644 --- a/PluginManager.cpp +++ b/PluginManager.cpp @@ -44,6 +44,7 @@ void PluginManager::ScanAndLoadPlugins() for(int i = 0; i < QDir(plugins_dir).entryList(QDir::Files).size(); i++) { + LOG_TRACE("[PluginManager] Found plugin file %s", QDir(plugins_dir).entryList(QDir::Files)[i].toStdString().c_str()); FileList.push_back(QDir(plugins_dir).entryList(QDir::Files)[i].toStdString()); } @@ -97,6 +98,8 @@ void PluginManager::AddPlugin(std::string path) { if(plugin->GetPluginAPIVersion() == OPENRGB_PLUGIN_API_VERSION) { + LOG_TRACE("[PluginManager] Plugin %s has a compatible API version", path.c_str()); + /*-----------------------------------------------------*\ | Get the plugin information | \*-----------------------------------------------------*/ @@ -184,6 +187,11 @@ void PluginManager::AddPlugin(std::string path) LoadPlugin(path); } } + else + { + loader->unload(); + LOG_WARNING("[PluginManager] Plugin %s has an incompatible API version", path.c_str()); + } } } } @@ -193,6 +201,8 @@ void PluginManager::RemovePlugin(std::string path) { unsigned int plugin_idx; + LOG_TRACE("[PluginManager] Attempting to remove plugin %s", path.c_str()); + /*---------------------------------------------------------------------*\ | Search active plugins to see if this path already exists | \*---------------------------------------------------------------------*/ @@ -209,6 +219,7 @@ void PluginManager::RemovePlugin(std::string path) \*---------------------------------------------------------------------*/ if(plugin_idx == ActivePlugins.size()) { + LOG_TRACE("[PluginManager] Plugin %s not active", path.c_str()); return; } @@ -217,6 +228,7 @@ void PluginManager::RemovePlugin(std::string path) \*---------------------------------------------------------------------*/ if(ActivePlugins[plugin_idx].loaded) { + LOG_TRACE("[PluginManager] Plugin %s is active, unloading", path.c_str()); UnloadPlugin(path); } diff --git a/qt/OpenRGBPluginsPage/OpenRGBPluginsPage.cpp b/qt/OpenRGBPluginsPage/OpenRGBPluginsPage.cpp index cf528e2d..4a70e8d0 100644 --- a/qt/OpenRGBPluginsPage/OpenRGBPluginsPage.cpp +++ b/qt/OpenRGBPluginsPage/OpenRGBPluginsPage.cpp @@ -104,6 +104,8 @@ bool Ui::OpenRGBPluginsPage::InstallPlugin(std::string install_file) std::string to_file = to_path + filesystem::path(from_path).filename().string(); bool match = false; + LOG_TRACE("[OpenRGBPluginsPage] Installing plugin %s", install_file.c_str()); + /*-----------------------------------------------------*\ | Check if a plugin with this path already exists | \*-----------------------------------------------------*/ @@ -139,7 +141,8 @@ bool Ui::OpenRGBPluginsPage::InstallPlugin(std::string install_file) { plugin_manager->RemovePlugin(to_file); - filesystem::copy(from_path, to_path, filesystem::copy_options::update_existing); + LOG_TRACE("[OpenRGBPluginsPage] Copying from %s to %s", from_path.c_str(), to_path.c_str()); + filesystem::copy(from_path, to_path, filesystem::copy_options::overwrite_existing); plugin_manager->AddPlugin(to_file); @@ -147,7 +150,7 @@ bool Ui::OpenRGBPluginsPage::InstallPlugin(std::string install_file) } catch(const std::exception& e) { - LOG_ERROR("[PluginsManager] Failed to install plugin: %s", e.what()); + LOG_ERROR("[OpenRGBPluginsPage] Failed to install plugin: %s", e.what()); } return false; @@ -193,7 +196,7 @@ void Ui::OpenRGBPluginsPage::on_RemovePluginButton_clicked() &&(plugin_settings["plugins"][plugin_idx].contains("description"))) { if((plugin_settings["plugins"][plugin_idx]["name"] == entries[cur_row]->ui->NameValue->text().toStdString()) - &&(plugin_settings["plugins"][plugin_idx]["description"] == entries[cur_row]->ui->DescriptionValue->text().toStdString())) + &&(plugin_settings["plugins"][plugin_idx]["description"] == entries[cur_row]->ui->DescriptionValue->text().toStdString())) { plugin_settings["plugins"].erase(plugin_idx);