mirror of https://github.com/kiwix/libkiwix.git
better deal with *.zimaa paths
This commit is contained in:
parent
63c210db1c
commit
956d37dee8
|
@ -41,8 +41,17 @@ namespace kiwix {
|
||||||
/* Constructor */
|
/* Constructor */
|
||||||
Reader::Reader(const string zimFilePath)
|
Reader::Reader(const string zimFilePath)
|
||||||
: zimFileHandler(NULL) {
|
: zimFileHandler(NULL) {
|
||||||
|
string tmpZimFilePath = zimFilePath;
|
||||||
|
|
||||||
this->zimFileHandler = new zim::File(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);
|
||||||
|
|
||||||
if (this->zimFileHandler != NULL) {
|
if (this->zimFileHandler != NULL) {
|
||||||
this->firstArticleOffset = this->zimFileHandler->getNamespaceBeginOffset('A');
|
this->firstArticleOffset = this->zimFileHandler->getNamespaceBeginOffset('A');
|
||||||
|
|
Loading…
Reference in New Issue