mirror of https://github.com/kiwix/libkiwix.git
commit
788d16ec01
|
@ -208,12 +208,16 @@ bool Manager::addBookFromPath(const std::string& pathToOpen,
|
||||||
|
|
||||||
bool Manager::readBookFromPath(const std::string& path, kiwix::Book* book)
|
bool Manager::readBookFromPath(const std::string& path, kiwix::Book* book)
|
||||||
{
|
{
|
||||||
|
std::string tmp_path = path;
|
||||||
|
if (isRelativePath(path)) {
|
||||||
|
tmp_path = computeAbsolutePath(getCurrentDirectory(), path);
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
kiwix::Reader reader(path);
|
kiwix::Reader reader(tmp_path);
|
||||||
book->update(reader);
|
book->update(reader);
|
||||||
book->setPathValid(true);
|
book->setPathValid(true);
|
||||||
} catch (const std::exception& e) {
|
} 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);
|
book->setPathValid(false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,8 +241,6 @@ Entry Reader::getMainPage() const
|
||||||
throw NoEntry();
|
throw NoEntry();
|
||||||
}
|
}
|
||||||
|
|
||||||
string url = "";
|
|
||||||
|
|
||||||
zim::Article article;
|
zim::Article article;
|
||||||
if (this->zimFileHandler->getFileheader().hasMainPage())
|
if (this->zimFileHandler->getFileheader().hasMainPage())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue