void cPluginManager::RefreshPluginList(void) { // Get a list of currently available folders: AString PluginsPath = GetPluginsPath() + "/"; AStringVector Contents = cFile::GetFolderContents(PluginsPath.c_str()); AStringVector Folders; for (auto & item: Contents) { if ((item == ".") || (item == "..") || (!cFile::IsFolder(PluginsPath + item))) { // We only want folders, and don't want "." or ".." continue; } Folders.push_back(item); } // for item - Contents[] // Set all plugins with invalid folders as psNotFound: for (auto & plugin: m_Plugins) { if (std::find(Folders.cbegin(), Folders.cend(), plugin->GetFolderName()) == Folders.end()) { plugin->m_Status = psNotFound; } } // for plugin - m_Plugins[] // Add all newly discovered plugins: for (auto & folder: Folders) { bool hasFound = false; for (auto & plugin: m_Plugins) { if (plugin->GetFolderName() == folder) { hasFound = true; break; } } // for plugin - m_Plugins[] if (!hasFound) { m_Plugins.push_back(std::make_shared<cPluginLua>(folder)); } } // for folder - Folders[] }