Files
yacreader/YACReaderLibraryServer/libraries_updater.cpp
luisangelsm 3709b6e737
Some checks failed
Build / Initialization (push) Has been cancelled
Build / Code Format Validation (push) Has been cancelled
Build / Linux (Qt6) (push) Has been cancelled
Build / Linux (Qt6 + 7zip) (push) Has been cancelled
Build / macOS (Qt6 Universal) (push) Has been cancelled
Build / Windows x64 (Qt6) (push) Has been cancelled
Build / Windows ARM64 (Qt6) (push) Has been cancelled
Build / Docker amd64 Image (push) Has been cancelled
Build / Docker arm64 Image (push) Has been cancelled
Build / Publish Dev Builds (push) Has been cancelled
Build / Publish Release (push) Has been cancelled
Build / Publish YACReader10 Pre-release Builds (push) Has been cancelled
Format includes using clang-format
2026-03-13 18:21:38 +01:00

37 lines
1.0 KiB
C++

#include "libraries_updater.h"
#include "data_base_management.h"
#include "yacreader_global.h"
#include "yacreader_libraries.h"
LibrariesUpdater::LibrariesUpdater()
{
}
void LibrariesUpdater::updateIfNeeded()
{
YACReaderLibraries libraries;
libraries.load();
foreach (QString name, libraries.getNames()) {
QString libraryPath = libraries.getPath(name);
QString libraryDataPath = YACReader::LibraryPaths::libraryDataPath(libraryPath);
QString databasePath = YACReader::LibraryPaths::libraryDatabasePath(libraryPath);
QDir d;
QString dbVersion;
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(libraryPath);
if (!updated) {
// TODO log error
}
}
}
}
}