Correctly set that book's path is valid when updating it from a reader.

This commit is contained in:
Matthieu Gautier 2019-08-12 12:09:10 +02:00
parent 9a0c6da018
commit 231ae095f6
1 changed files with 5 additions and 1 deletions

View File

@ -29,7 +29,9 @@
namespace kiwix namespace kiwix
{ {
/* Constructor */ /* Constructor */
Book::Book() : m_readOnly(false) Book::Book() :
m_pathValid(false),
m_readOnly(false)
{ {
} }
/* Destructor */ /* Destructor */
@ -46,6 +48,7 @@ bool Book::update(const kiwix::Book& other)
if (m_path.empty()) { if (m_path.empty()) {
m_path = other.m_path; m_path = other.m_path;
m_pathValid = other.m_pathValid;
} }
if (m_url.empty()) { if (m_url.empty()) {
@ -83,6 +86,7 @@ void Book::update(const kiwix::Reader& reader)
m_articleCount = reader.getArticleCount(); m_articleCount = reader.getArticleCount();
m_mediaCount = reader.getMediaCount(); m_mediaCount = reader.getMediaCount();
m_size = static_cast<uint64_t>(reader.getFileSize()) << 10; m_size = static_cast<uint64_t>(reader.getFileSize()) << 10;
m_pathValid = true;
reader.getFavicon(m_favicon, m_faviconMimeType); reader.getFavicon(m_favicon, m_faviconMimeType);
} }