mirror of https://github.com/kiwix/libkiwix.git
better deal with *.zimaa paths
This commit is contained in:
parent
63c210db1c
commit
956d37dee8
|
@ -41,9 +41,18 @@ namespace kiwix {
|
|||
/* Constructor */
|
||||
Reader::Reader(const string zimFilePath)
|
||||
: zimFileHandler(NULL) {
|
||||
string tmpZimFilePath = zimFilePath;
|
||||
|
||||
/* Remove potential trailing zimaa */
|
||||
size_t found = tmpZimFilePath.rfind("zimaa");
|
||||
if (found != string::npos &&
|
||||
tmpZimFilePath.size() > 5 &&
|
||||
found == tmpZimFilePath.size() - 5) {
|
||||
tmpZimFilePath.resize(tmpZimFilePath.size() - 2);
|
||||
}
|
||||
|
||||
this->zimFileHandler = new zim::File(tmpZimFilePath);
|
||||
|
||||
this->zimFileHandler = new zim::File(zimFilePath);
|
||||
|
||||
if (this->zimFileHandler != NULL) {
|
||||
this->firstArticleOffset = this->zimFileHandler->getNamespaceBeginOffset('A');
|
||||
this->lastArticleOffset = this->zimFileHandler->getNamespaceEndOffset('A');
|
||||
|
|
Loading…
Reference in New Issue