@@ -77,6 +77,7 @@ void usage()
77
77
<< " \t -z, --nodatealiases\t Create URL aliases for each content by removing the date" << std::endl
78
78
<< " \t -c, --customIndex\t Add path to custom index.html for welcome page" << std::endl
79
79
<< " \t -L, --ipConnectionLimit\t Max number of (concurrent) connections per IP (default: infinite, recommended: >= 6)" << std::endl
80
+ << " \t -k, --skipInvalid\t Startup even when ZIM files are invalid (those will be skipped)" << std::endl
80
81
<< std::endl
81
82
82
83
<< " Documentation:" << std::endl
@@ -217,6 +218,7 @@ int main(int argc, char** argv)
217
218
unsigned int PPID = 0 ;
218
219
int ipConnectionLimit = 0 ;
219
220
int searchLimit = 0 ;
221
+ bool skipInvalid = false ;
220
222
221
223
static struct option long_options[]
222
224
= {{" daemon" , no_argument, 0 , ' d' },
@@ -237,6 +239,7 @@ int main(int argc, char** argv)
237
239
{" monitorLibrary" , no_argument, 0 , ' M' },
238
240
{" ipConnectionLimit" , required_argument, 0 , ' L' },
239
241
{" searchLimit" , required_argument, 0 , ' s' },
242
+ {" skipInvalid" , no_argument, 0 , ' k' },
240
243
{0 , 0 , 0 , 0 }};
241
244
242
245
std::set<int > usedOptions;
@@ -307,6 +310,9 @@ int main(int argc, char** argv)
307
310
case ' s' :
308
311
searchLimit = atoi (optarg );
309
312
break ;
313
+ case ' k' :
314
+ skipInvalid = true ;
315
+ break ;
310
316
case ' ?' :
311
317
usage ();
312
318
return 2 ;
@@ -348,9 +354,13 @@ int main(int argc, char** argv)
348
354
std::vector<std::string>::iterator it;
349
355
for (it = zimPathes.begin (); it != zimPathes.end (); it++) {
350
356
if (!manager.addBookFromPath (*it, *it, " " , false )) {
351
- std::cerr << " Unable to add the ZIM file '" << *it
352
- << " ' to the internal library." << std::endl;
353
- exit (1 );
357
+ if (skipInvalid) {
358
+ std::cerr << " Skipping invalid '" << *it << " ' ...continuing" << std::endl;
359
+ } else {
360
+ std::cerr << " Unable to add the ZIM file '" << *it
361
+ << " ' to the internal library." << std::endl;
362
+ exit (1 );
363
+ }
354
364
}
355
365
}
356
366
}
0 commit comments