+ try to fix ZIM loading problem on Windows with library relative paths

This commit is contained in:
kelson42 2012-06-14 18:32:41 +00:00
parent 9fff4b1bac
commit 084af011dd
2 changed files with 8 additions and 3 deletions

View File

@ -95,12 +95,16 @@ namespace kiwix {
}
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;
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) {
this->parseXmlDom(doc, readOnly, path);
this->parseXmlDom(doc, readOnly, UTF8Path);
} else {
retVal = false;
}
@ -109,7 +113,7 @@ namespace kiwix {
* able to know where to save the library if new content are
* available */
if (!readOnly) {
this->writableLibraryPath = path;
this->writableLibraryPath = UTF8Path;
}
return retVal;

View File

@ -46,6 +46,7 @@ namespace kiwix {
~Manager();
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 writeFile(const string path);
bool removeBookByIndex(const unsigned int bookIndex);