MCPcopy Create free account
hub / github.com/crosspoint-reader/crosspoint-reader / updatePath

Method updatePath

src/RecentBooksStore.cpp:73–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73void RecentBooksStore::updatePath(const std::string& oldPath, const std::string& newPath,
74 const std::string& oldCachePath, const std::string& newCachePath) {
75 auto it = std::find_if(recentBooks.begin(), recentBooks.end(),
76 [&](const RecentBook& book) { return book.path == oldPath; });
77 if (it == recentBooks.end()) {
78 return;
79 }
80 it->path = newPath;
81 if (!oldCachePath.empty() && !it->coverBmpPath.empty() && it->coverBmpPath.rfind(oldCachePath, 0) == 0) {
82 it->coverBmpPath = newCachePath + it->coverBmpPath.substr(oldCachePath.size());
83 }
84 saveToFile();
85}
86
87bool RecentBooksStore::isMissing(const RecentBook& book) { return !Storage.exists(book.path.c_str()); }
88

Callers 1

Calls 4

endMethod · 0.80
beginMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected