|
a/src/aspell/rclaspell.cpp |
|
b/src/aspell/rclaspell.cpp |
|
... |
|
... |
295 |
args.push_back(string("--lang=")+ m_lang);
|
295 |
args.push_back(string("--lang=")+ m_lang);
|
296 |
args.push_back("--encoding=utf-8");
|
296 |
args.push_back("--encoding=utf-8");
|
297 |
args.push_back("create");
|
297 |
args.push_back("create");
|
298 |
args.push_back("master");
|
298 |
args.push_back("master");
|
299 |
args.push_back(dicPath());
|
299 |
args.push_back(dicPath());
|
|
|
300 |
|
|
|
301 |
// Have to disable stderr, as numerous messages about bad strings are
|
|
|
302 |
// printed. We'd like to keep errors about missing databases though, so
|
|
|
303 |
// make it configurable for diags
|
|
|
304 |
bool keepStderr = false;
|
|
|
305 |
m_config->getConfParam("aspellKeepStderr", &keepStderr);
|
|
|
306 |
if (!keepStderr)
|
300 |
aspell.setStderr("/dev/null");
|
307 |
aspell.setStderr("/dev/null");
|
301 |
|
308 |
|
302 |
Rcl::TermIter *tit = db.termWalkOpen();
|
309 |
Rcl::TermIter *tit = db.termWalkOpen();
|
303 |
if (tit == 0) {
|
310 |
if (tit == 0) {
|
304 |
reason = "termWalkOpen failed\n";
|
311 |
reason = "termWalkOpen failed\n";
|
305 |
return false;
|
312 |
return false;
|
306 |
}
|
313 |
}
|
307 |
|
|
|
308 |
string termbuf;
|
314 |
string termbuf;
|
309 |
AspExecPv pv(&termbuf, tit, db);
|
315 |
AspExecPv pv(&termbuf, tit, db);
|
310 |
aspell.setProvide(&pv);
|
316 |
aspell.setProvide(&pv);
|
311 |
|
317 |
|
312 |
if (aspell.doexec(m_data->m_exec, args, &termbuf)) {
|
318 |
if (aspell.doexec(m_data->m_exec, args, &termbuf)) {
|
|
|
319 |
ExecCmd cmd;
|
|
|
320 |
args.clear();
|
|
|
321 |
args.push_back("dicts");
|
|
|
322 |
string dicts;
|
|
|
323 |
bool hasdict = false;
|
|
|
324 |
if (!cmd.doexec(m_data->m_exec, args, 0, &dicts)) {
|
|
|
325 |
vector<string> vdicts;
|
|
|
326 |
stringToTokens(dicts, vdicts, "\n\r\t ");
|
|
|
327 |
if (find(vdicts.begin(), vdicts.end(), m_lang) != vdicts.end()) {
|
|
|
328 |
hasdict = true;
|
|
|
329 |
}
|
|
|
330 |
}
|
|
|
331 |
if (hasdict)
|
|
|
332 |
reason = string(
|
|
|
333 |
"\naspell dictionary creation command failed. Reason unknown.\n"
|
|
|
334 |
"Try to set aspellKeepStderr = 1 in recoll.conf, and execute \n"
|
|
|
335 |
"the indexing command in a terminal to see the aspell "
|
|
|
336 |
"diagnostic output.\n");
|
|
|
337 |
else
|
313 |
reason = string("aspell dictionary creation command failed.\n"
|
338 |
reason = string("aspell dictionary creation command failed.\n"
|
314 |
"One possible reason might be missing language "
|
339 |
"One possible reason might be missing language "
|
315 |
"data files for lang = ") + m_lang;
|
340 |
"data files for lang = ") + m_lang;
|
316 |
return false;
|
341 |
return false;
|
317 |
}
|
342 |
}
|
318 |
db.termWalkClose(tit);
|
343 |
db.termWalkClose(tit);
|
319 |
return true;
|
344 |
return true;
|
320 |
}
|
345 |
}
|