| 71 | } |
| 72 | |
| 73 | void 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 | |
| 87 | bool RecentBooksStore::isMissing(const RecentBook& book) { return !Storage.exists(book.path.c_str()); } |
| 88 |
no test coverage detected