mirror of https://github.com/kiwix/libkiwix.git
+ try to fix ZIM loading problem on Windows with library relative paths
This commit is contained in:
parent
9fff4b1bac
commit
084af011dd
|
@ -95,12 +95,16 @@ namespace kiwix {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Manager::readFile(const string path, const bool readOnly) {
|
bool Manager::readFile(const string path, const bool readOnly) {
|
||||||
|
return this->readFile(path, path, readOnly);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Manager::readFile(const string nativePath, const string UTF8Path, const bool readOnly) {
|
||||||
bool retVal = true;
|
bool retVal = true;
|
||||||
pugi::xml_document doc;
|
pugi::xml_document doc;
|
||||||
pugi::xml_parse_result result = doc.load_file(path.c_str());
|
pugi::xml_parse_result result = doc.load_file(nativePath.c_str());
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
this->parseXmlDom(doc, readOnly, path);
|
this->parseXmlDom(doc, readOnly, UTF8Path);
|
||||||
} else {
|
} else {
|
||||||
retVal = false;
|
retVal = false;
|
||||||
}
|
}
|
||||||
|
@ -109,7 +113,7 @@ namespace kiwix {
|
||||||
* able to know where to save the library if new content are
|
* able to know where to save the library if new content are
|
||||||
* available */
|
* available */
|
||||||
if (!readOnly) {
|
if (!readOnly) {
|
||||||
this->writableLibraryPath = path;
|
this->writableLibraryPath = UTF8Path;
|
||||||
}
|
}
|
||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
|
|
|
@ -46,6 +46,7 @@ namespace kiwix {
|
||||||
~Manager();
|
~Manager();
|
||||||
|
|
||||||
bool readFile(const string path, const bool readOnly = true);
|
bool readFile(const string path, const bool readOnly = true);
|
||||||
|
bool readFile(const string nativePath, const string UTF8Path, const bool readOnly = true);
|
||||||
bool readXml(const string xml, const bool readOnly = true, const string libraryPath = "");
|
bool readXml(const string xml, const bool readOnly = true, const string libraryPath = "");
|
||||||
bool writeFile(const string path);
|
bool writeFile(const string path);
|
||||||
bool removeBookByIndex(const unsigned int bookIndex);
|
bool removeBookByIndex(const unsigned int bookIndex);
|
||||||
|
|
Loading…
Reference in New Issue