mirror of
https://github.com/kiwix/kiwix-tools.git
synced 2025-09-22 19:38:53 -04:00
+ small fix in kiwix-serve after the template engine integration
This commit is contained in:
parent
20bb6b938b
commit
156a482d3b
@ -232,8 +232,6 @@ static int accessHandlerCallback(void *cls,
|
|||||||
unsigned int startNumber = 0;
|
unsigned int startNumber = 0;
|
||||||
unsigned int endNumber = 25;
|
unsigned int endNumber = 25;
|
||||||
|
|
||||||
cout << "---" << start << endl;
|
|
||||||
|
|
||||||
if (start != NULL)
|
if (start != NULL)
|
||||||
startNumber = atoi(start);
|
startNumber = atoi(start);
|
||||||
|
|
||||||
@ -353,8 +351,8 @@ static int accessHandlerCallback(void *cls,
|
|||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
struct MHD_Daemon *daemon;
|
struct MHD_Daemon *daemon;
|
||||||
string zimPath = "";
|
string zimPath = "";
|
||||||
|
|
||||||
string indexPath = "";
|
string indexPath = "";
|
||||||
|
char rootPath[PATH_MAX];
|
||||||
int serverPort = 80;
|
int serverPort = 80;
|
||||||
int daemonFlag = false;
|
int daemonFlag = false;
|
||||||
|
|
||||||
@ -408,10 +406,6 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
void *page;
|
void *page;
|
||||||
|
|
||||||
/* Chnage the current dir to binary dir */
|
|
||||||
const char* currentDirectory = dirname(argv[0]);
|
|
||||||
chdir(currentDirectory);
|
|
||||||
|
|
||||||
/* Instanciate the ZIM file handler */
|
/* Instanciate the ZIM file handler */
|
||||||
try {
|
try {
|
||||||
reader = new kiwix::Reader(zimPath);
|
reader = new kiwix::Reader(zimPath);
|
||||||
@ -431,10 +425,14 @@ int main(int argc, char **argv) {
|
|||||||
cerr << "Unable to open the search index '" << zimPath << "' with the XapianSearcher." << endl;
|
cerr << "Unable to open the search index '" << zimPath << "' with the XapianSearcher." << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 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 to load the result template */
|
||||||
try {
|
try {
|
||||||
fstream templateStream;
|
fstream templateStream;
|
||||||
char rootPath[PATH_MAX];
|
|
||||||
templateStream.open("../share/kiwix/static/results.tmpl", ifstream::in);
|
templateStream.open("../share/kiwix/static/results.tmpl", ifstream::in);
|
||||||
|
|
||||||
if (templateStream.fail()) {
|
if (templateStream.fail()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user