##// END OF EJS Templates
Fix the loading of the default database
trabillard -
r1126:4b00ad8b6024
parent child
Show More
@@ -63,9 +63,8 void CatalogueController::addDB(const QString &dbPath)
63 qCCritical(LOG_CatalogueController())
63 qCCritical(LOG_CatalogueController())
64 << tr("Impossible to addDB %1 from %2 ").arg(dirName, dbPath);
64 << tr("Impossible to addDB %1 from %2 ").arg(dirName, dbPath);
65 }
65 }
66 else
66 else {
67 {
67 impl->m_RepositoryList.push_back(dirName);
68 impl->m_RepositoryList << dirName;
69 }
68 }
70 }
69 }
71 else {
70 else {
@@ -109,15 +108,24 void CatalogueController::initialize()
109 << QThread::currentThread();
108 << QThread::currentThread();
110 impl->m_WorkingMutex.lock();
109 impl->m_WorkingMutex.lock();
111 impl->m_CatalogueDao.initialize();
110 impl->m_CatalogueDao.initialize();
112 auto defaultRepository = QString("%1/%2").arg(
111 auto defaultRepositoryLocation
113 QStandardPaths::displayName(QStandardPaths::AppDataLocation), REPOSITORY_DEFAULT);
112 = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
114 QDir defaultRepositoryDir(defaultRepository);
113
115 if (defaultRepositoryDir.exists()) {
114 QDir defaultRepositoryLocationDir;
116 qCInfo(LOG_CatalogueController()) << tr("Persistant data loading from: ")
115 if (defaultRepositoryLocationDir.mkpath(defaultRepositoryLocation)) {
117 << defaultRepository;
116 defaultRepositoryLocationDir.cd(defaultRepositoryLocation);
117 auto defaultRepository = defaultRepositoryLocationDir.absoluteFilePath(REPOSITORY_DEFAULT);
118 qCInfo(LOG_CatalogueController())
119 << tr("Persistant data loading from: ") << defaultRepository;
118 this->addDB(defaultRepository);
120 this->addDB(defaultRepository);
119 qCDebug(LOG_CatalogueController()) << tr("CatalogueController init END");
120 }
121 }
122 else {
123 qCWarning(LOG_CatalogueController())
124 << tr("Cannot load the persistent default repository from ")
125 << defaultRepositoryLocation;
126 }
127
128 qCDebug(LOG_CatalogueController()) << tr("CatalogueController init END");
121 }
129 }
122
130
123 void CatalogueController::finalize()
131 void CatalogueController::finalize()
General Comments 0
You need to be logged in to leave comments. Login now