mirror of
https://github.com/kiwix/kiwix-tools.git
synced 2025-09-22 03:12:20 -04:00
+ 2nd regression fix
This commit is contained in:
parent
0ae076b5ad
commit
417749a3fc
@ -416,33 +416,6 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
/* Instanciate the ZIM index (if necessary) */
|
/* Instanciate the ZIM index (if necessary) */
|
||||||
if (indexPath != "") {
|
if (indexPath != "") {
|
||||||
/* Change the current dir to binary dir */
|
|
||||||
/* Non portable linux solution */
|
|
||||||
readlink("/proc/self/exe", rootPath, PATH_MAX);
|
|
||||||
chdir(dirname(rootPath));
|
|
||||||
|
|
||||||
/* Try to load the result template */
|
|
||||||
try {
|
|
||||||
fstream templateStream;
|
|
||||||
templateStream.open("../share/kiwix/static/results.tmpl", ifstream::in);
|
|
||||||
|
|
||||||
if (templateStream.fail()) {
|
|
||||||
templateStream.open("../../static/results.tmpl", ifstream::in);
|
|
||||||
|
|
||||||
if (templateStream.fail()) {
|
|
||||||
throw "Unable to find a result template file.";
|
|
||||||
} else {
|
|
||||||
realpath("../../static/results.tmpl", rootPath);
|
|
||||||
searcher->setResultTemplatePath(rootPath);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
realpath("../share/kiwix/static/results.tmpl", rootPath);
|
|
||||||
searcher->setResultTemplatePath(rootPath);
|
|
||||||
}
|
|
||||||
} catch (...) {
|
|
||||||
cerr << "Unable to open the result template file." << endl;
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Try with the XapianSearcher */
|
/* Try with the XapianSearcher */
|
||||||
try {
|
try {
|
||||||
@ -463,9 +436,40 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* searcher configuration */
|
/* searcher configuration */
|
||||||
searcher->setProtocolPrefix("/");
|
if (hasSearchIndex) {
|
||||||
searcher->setSearchProtocolPrefix("/search?");
|
|
||||||
|
/* Change the current dir to binary dir */
|
||||||
|
/* Non portable linux solution */
|
||||||
|
readlink("/proc/self/exe", rootPath, PATH_MAX);
|
||||||
|
chdir(dirname(rootPath));
|
||||||
|
|
||||||
|
/* Try to load the result template */
|
||||||
|
try {
|
||||||
|
fstream templateStream;
|
||||||
|
templateStream.open("../share/kiwix/static/results.tmpl", ifstream::in);
|
||||||
|
|
||||||
|
if (templateStream.fail()) {
|
||||||
|
templateStream.open("../../static/results.tmpl", ifstream::in);
|
||||||
|
|
||||||
|
if (templateStream.fail()) {
|
||||||
|
throw "Unable to find a result template file.";
|
||||||
|
} else {
|
||||||
|
realpath("../../static/results.tmpl", rootPath);
|
||||||
|
searcher->setResultTemplatePath(rootPath);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
realpath("../share/kiwix/static/results.tmpl", rootPath);
|
||||||
|
searcher->setResultTemplatePath(rootPath);
|
||||||
|
}
|
||||||
|
} catch (...) {
|
||||||
|
cerr << "Unable to open the result template file." << endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
searcher->setProtocolPrefix("/");
|
||||||
|
searcher->setSearchProtocolPrefix("/search?");
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
hasSearchIndex = false;
|
hasSearchIndex = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user