mirror of https://github.com/kiwix/libkiwix.git
Use new libzim method `getFaviconEntry` to get the favicon.
This commit is contained in:
parent
9941d245e1
commit
ba302bed33
|
@ -179,17 +179,13 @@ Entry Reader::getMainPage() const
|
||||||
|
|
||||||
bool Reader::getFavicon(string& content, string& mimeType) const
|
bool Reader::getFavicon(string& content, string& mimeType) const
|
||||||
{
|
{
|
||||||
static const char* const paths[] = {"-/favicon", "-/favicon.png", "I/favicon.png", "I/favicon"};
|
try {
|
||||||
|
auto entry = zimArchive->getFaviconEntry();
|
||||||
for (auto &path: paths) {
|
auto item = entry.getItem(true);
|
||||||
try {
|
content = item.getData();
|
||||||
auto entry = zimArchive->getEntryByPath(path);
|
mimeType = item.getMimetype();
|
||||||
auto item = entry.getItem(true);
|
return true;
|
||||||
content = item.getData();
|
} catch(zim::EntryNotFound& e) {};
|
||||||
mimeType = item.getMimetype();
|
|
||||||
return true;
|
|
||||||
} catch(zim::EntryNotFound& e) {};
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue