feat: port crossink 'read book move' feature to crosspoint (#2032)
This commit is contained in:
@@ -56,6 +56,20 @@ void RecentBooksStore::updateBook(const std::string& path, const std::string& ti
|
||||
}
|
||||
}
|
||||
|
||||
void RecentBooksStore::updatePath(const std::string& oldPath, const std::string& newPath,
|
||||
const std::string& oldCachePath, const std::string& newCachePath) {
|
||||
auto it = std::find_if(recentBooks.begin(), recentBooks.end(),
|
||||
[&](const RecentBook& book) { return book.path == oldPath; });
|
||||
if (it == recentBooks.end()) {
|
||||
return;
|
||||
}
|
||||
it->path = newPath;
|
||||
if (!oldCachePath.empty() && !it->coverBmpPath.empty() && it->coverBmpPath.rfind(oldCachePath, 0) == 0) {
|
||||
it->coverBmpPath = newCachePath + it->coverBmpPath.substr(oldCachePath.size());
|
||||
}
|
||||
saveToFile();
|
||||
}
|
||||
|
||||
bool RecentBooksStore::isMissing(const RecentBook& book) { return !Storage.exists(book.path.c_str()); }
|
||||
|
||||
bool RecentBooksStore::pruneMissing() {
|
||||
|
||||
Reference in New Issue
Block a user