----------------------------------------------------------------------------
| 366 | |
| 367 | //---------------------------------------------------------------------------- |
| 368 | QSharedPointer<ctkPluginArchive> ctkPluginStorageSQL::insertPlugin(const QUrl& location, const QString& localPath) |
| 369 | { |
| 370 | QMutexLocker lock(&m_archivesLock); |
| 371 | |
| 372 | QFileInfo fileInfo(localPath); |
| 373 | if (!fileInfo.exists()) |
| 374 | { |
| 375 | throw ctkInvalidArgumentException(localPath + " does not exist"); |
| 376 | } |
| 377 | |
| 378 | const QString libTimestamp = getStringFromQDateTime(fileInfo.lastModified()); |
| 379 | |
| 380 | QSharedPointer<ctkPluginArchiveSQL> archive(new ctkPluginArchiveSQL(this, location, localPath, |
| 381 | m_nextFreeId++)); |
| 382 | try |
| 383 | { |
| 384 | insertArchive(archive); |
| 385 | m_archives << archive; |
| 386 | return archive; |
| 387 | } |
| 388 | catch(...) |
| 389 | { |
| 390 | m_nextFreeId--; |
| 391 | throw; |
| 392 | } |
| 393 | } |
| 394 | |
| 395 | //---------------------------------------------------------------------------- |
| 396 | void ctkPluginStorageSQL::insertArchive(QSharedPointer<ctkPluginArchiveSQL> pa) |