Skip to content

Commit

Permalink
Manager::reload() also removes books from Library
Browse files Browse the repository at this point in the history
  • Loading branch information
veloman-yunkan committed Nov 28, 2021
1 parent 65e83af commit 95658fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ class Manager
* Sync the contents of the library with one or more `library.xml` files.
*
* The metadata of the library files is trusted unconditionally.
* Any books not present in the input library.xml files are removed
* from the library.
*
* @param paths The (utf8) paths to the `library.xml` files.
*/
Expand Down
5 changes: 5 additions & 0 deletions src/manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ bool Manager::readBookmarkFile(const std::string& path)

void Manager::reload(const Paths& paths)
{
const auto libRevision = manipulator->getLibrary().getRevision();
for (std::string path : paths) {
if (!path.empty()) {
if ( kiwix::isRelativePath(path) )
Expand All @@ -301,6 +302,10 @@ void Manager::reload(const Paths& paths)
}
}
}

// XXX: must remove the books via manipulator, otherwise the event
// XXX: may go unnoticed
manipulator->getLibrary().removeBooksNotUpdatedSince(libRevision);
}

}

0 comments on commit 95658fb

Please sign in to comment.