diff --git a/src/common/kiwix/reader.cpp b/src/common/kiwix/reader.cpp index 15f3d9506..c7910e7db 100644 --- a/src/common/kiwix/reader.cpp +++ b/src/common/kiwix/reader.cpp @@ -422,4 +422,16 @@ namespace kiwix { return true; } + + /* Return the file size, works also for splitted files */ + unsigned int Reader::getFileSize() { + zim::File *file = this->getZimFileHandler(); + zim::offset_type size = 0; + + if (file != NULL) { + size = file->getFilesize(); + } + + return size; + } } diff --git a/src/common/kiwix/reader.h b/src/common/kiwix/reader.h index e2d8a7834..a0829b5f6 100644 --- a/src/common/kiwix/reader.h +++ b/src/common/kiwix/reader.h @@ -30,6 +30,7 @@ #include #include #include "time.h" +#include "../pathTools.h" using namespace std; @@ -63,6 +64,7 @@ namespace kiwix { bool canCheckIntegrity(); bool isCorrupted(); bool parseUrl(const string &urlStr, char *ns, string &titleStr); + unsigned int getFileSize(); zim::File* getZimFileHandler(); protected: