Merge pull request #197 from kiwix/ensure_path_abs

Ensure path abs
This commit is contained in:
Matthieu Gautier 2019-02-07 15:55:51 +01:00 committed by GitHub
commit 788d16ec01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -208,12 +208,16 @@ bool Manager::addBookFromPath(const std::string& pathToOpen,
bool Manager::readBookFromPath(const std::string& path, kiwix::Book* book)
{
std::string tmp_path = path;
if (isRelativePath(path)) {
tmp_path = computeAbsolutePath(getCurrentDirectory(), path);
}
try {
kiwix::Reader reader(path);
kiwix::Reader reader(tmp_path);
book->update(reader);
book->setPathValid(true);
} catch (const std::exception& e) {
std::cerr << "Invalid " << path << " : " << e.what() << std::endl;
std::cerr << "Invalid " << tmp_path << " : " << e.what() << std::endl;
book->setPathValid(false);
return false;
}

View File

@ -241,8 +241,6 @@ Entry Reader::getMainPage() const
throw NoEntry();
}
string url = "";
zim::Article article;
if (this->zimFileHandler->getFileheader().hasMainPage())
{