mirror of
https://github.com/YACReader/yacreader
synced 2025-10-13 07:25:32 -04:00
Extract library paths methods to it's own struct in yacreader_global.h and use it everywhere
This commit is contained in:
@ -14,16 +14,18 @@ void LibrariesUpdater::updateIfNeeded()
|
||||
libraries.load();
|
||||
|
||||
foreach (QString name, libraries.getNames()) {
|
||||
QString path = libraries.getPath(name) + "/.yacreaderlibrary";
|
||||
QString root = libraries.getPath(name);
|
||||
QString libraryDataPath = YACReader::LibraryPaths::libraryDataPath(root);
|
||||
QString databasePath = YACReader::LibraryPaths::libraryDatabasePath(root);
|
||||
|
||||
QDir d;
|
||||
|
||||
QString dbVersion;
|
||||
if (d.exists(path) && d.exists(path + "/library.ydb") && (dbVersion = DataBaseManagement::checkValidDB(path + "/library.ydb")) != "") {
|
||||
if (d.exists(libraryDataPath) && d.exists(databasePath) && (dbVersion = DataBaseManagement::checkValidDB(databasePath)) != "") {
|
||||
int comparation = DataBaseManagement::compareVersions(dbVersion, DB_VERSION);
|
||||
|
||||
if (comparation < 0) {
|
||||
bool updated = DataBaseManagement::updateToCurrentVersion(path);
|
||||
bool updated = DataBaseManagement::updateToCurrentVersion(libraryDataPath);
|
||||
if (!updated) {
|
||||
// TODO log error
|
||||
}
|
||||
|
Reference in New Issue
Block a user