MCPcopy Create free account
hub / github.com/YACReader/yacreader / updateIfNeeded

Method updateIfNeeded

YACReaderLibraryServer/libraries_updater.cpp:13–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11}
12
13void LibrariesUpdater::updateIfNeeded()
14{
15 YACReaderLibraries libraries;
16
17 libraries.load();
18
19 for (const QString &name : libraries.getNames()) {
20 QString libraryPath = libraries.getPath(name);
21 QString libraryDataPath = YACReader::LibraryPaths::libraryDataPath(libraryPath);
22 QString databasePath = YACReader::LibraryPaths::libraryDatabasePath(libraryPath);
23
24 QDir d;
25
26 QString dbVersion;
27 if (d.exists(libraryDataPath) && d.exists(databasePath) && (dbVersion = DataBaseManagement::checkValidDB(databasePath)) != "") {
28 int comparation = DataBaseManagement::compareVersions(dbVersion, DB_VERSION);
29
30 if (comparation < 0) {
31 bool updated = DataBaseManagement::updateToCurrentVersion(libraryPath);
32 if (!updated) {
33 // TODO log error
34 }
35 }
36 }
37 }
38}

Callers 1

startFunction · 0.80

Calls 3

getNamesMethod · 0.80
getPathMethod · 0.80
loadMethod · 0.45

Tested by

no test coverage detected