| 254 | } |
| 255 | |
| 256 | int CManager::FindPlugins(QDir dir, QStringList filters) |
| 257 | { |
| 258 | QString fileName; |
| 259 | |
| 260 | QString szCurrentPath = QDir::currentPath(); |
| 261 | QStringList files = dir.entryList(filters, QDir::Files | QDir::NoDotAndDotDot); |
| 262 | if(!files.isEmpty()) |
| 263 | { |
| 264 | //This method is invalid |
| 265 | //QCoreApplication::addLibraryPath(QDir::cleanPath(dir.absolutePath())); |
| 266 | |
| 267 | QDir::setCurrent(QDir::cleanPath(dir.absolutePath())); |
| 268 | |
| 269 | // This method is valid |
| 270 | //#if defined(Q_OS_WINDOWS) |
| 271 | // QString szPath = QString::fromLocal8Bit(qgetenv("PATH")); |
| 272 | // szPath += ";"; |
| 273 | // szPath += QDir::cleanPath(dir.absolutePath()); |
| 274 | // qputenv("PATH", szPath.toLatin1()); |
| 275 | //#endif |
| 276 | } |
| 277 | |
| 278 | foreach (fileName, files) { |
| 279 | QString szPlugins = dir.absoluteFilePath(fileName); |
| 280 | if(m_pParameterPlugin |
| 281 | && (!m_pParameterPlugin->m_WhiteList.contains(fileName) || !m_pParameterPlugin->m_WhiteList.contains(fileName)) |
| 282 | && (m_pParameterPlugin->m_BlackList.contains(fileName) || m_pParameterPlugin->m_BlackList.contains(fileName))) { |
| 283 | qInfo(log) << "Filter:" << szPlugins << "in blacklist"; |
| 284 | continue; |
| 285 | } |
| 286 | LoadPlugin(szPlugins); |
| 287 | } |
| 288 | |
| 289 | foreach (fileName, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) { |
| 290 | QDir pluginDir = dir; |
| 291 | if(pluginDir.cd(fileName)) |
| 292 | FindPlugins(pluginDir, filters); |
| 293 | } |
| 294 | |
| 295 | QDir::setCurrent(szCurrentPath); |
| 296 | |
| 297 | return 0; |
| 298 | } |
| 299 | |
| 300 | int CManager::LoadPlugin(const QString &szPath) |
| 301 | { |