Switch to unified view

a/src/aspell/rclaspell.cpp b/src/aspell/rclaspell.cpp
...
...
149
    reason = "aspell program not found or not executable";
149
    reason = "aspell program not found or not executable";
150
        deleteZ(m_data);
150
        deleteZ(m_data);
151
    return false;
151
    return false;
152
    }
152
    }
153
153
154
    // We first look for the aspell library in libdir, and also try to
155
    // be clever with ASPELL_PROG.
156
    vector<string> libdirs;
157
    libdirs.push_back(LIBDIR);
158
    // If not in the standard place, the aspell library has to live
159
    // under the same prefix as the aspell program.
160
    {
161
  string aspellPrefix = path_getfather(path_getfather(m_data->m_exec));
162
  // This would probably require some more tweaking on solaris/irix etc.
163
  string dir = sizeof(long) > 4 ? "lib64" : "lib";
164
  string libaspell = path_cat(aspellPrefix, dir);
165
  if (libaspell != LIBDIR)
166
      libdirs.push_back(libaspell);
167
    }
168
169
    reason = "Could not open shared library ";
154
    reason = "Could not open shared library ";
170
    for (vector<string>::iterator it = libdirs.begin(); 
155
    string libbase("libaspell");
171
   it != libdirs.end(); it++) {
172
  string libbase = path_cat(*it, "libaspell");
173
  string lib;
156
    string lib;
174
  for (unsigned int i = 0; i < nlibsuffs; i++) {
157
    for (unsigned int i = 0; i < nlibsuffs; i++) {
175
      lib = libbase + aspell_lib_suffixes[i];
158
        lib = libbase + aspell_lib_suffixes[i];
176
      reason += string("[") + lib + "] ";
159
        reason += string("[") + lib + "] ";
177
      if ((m_data->m_handle = dlopen(lib.c_str(), RTLD_LAZY)) != 0) {
160
        if ((m_data->m_handle = dlopen(lib.c_str(), RTLD_LAZY)) != 0) {
178
      reason.erase();
161
            reason.erase();
179
      goto found;
162
            goto found;
180
      }
163
        }
181
  }
182
    }
164
    }
183
    
165
    
184
 found:
166
 found:
185
    if (m_data->m_handle == 0) {
167
    if (m_data->m_handle == 0) {
186
        reason += string(" : ") + dlerror();
168
        reason += string(" : ") + dlerror();
...
...
286
    if (!ok())
268
    if (!ok())
287
    return false;
269
    return false;
288
270
289
    // We create the dictionary by executing the aspell command:
271
    // We create the dictionary by executing the aspell command:
290
    // aspell --lang=[lang] create master [dictApath]
272
    // aspell --lang=[lang] create master [dictApath]
273
    string cmdstring(m_data->m_exec);
291
    ExecCmd aspell;
274
    ExecCmd aspell;
292
    vector<string> args;
275
    vector<string> args;
293
    args.push_back(string("--lang=")+ m_lang);
276
    args.push_back(string("--lang=")+ m_lang);
277
    cmdstring += string(" ") + string("--lang=") + m_lang;
294
    args.push_back("--encoding=utf-8");
278
    args.push_back("--encoding=utf-8");
279
    cmdstring += string(" ") + "--encoding=utf-8";
295
    args.push_back("create");
280
    args.push_back("create");
281
    cmdstring += string(" ") + "create";
296
    args.push_back("master");
282
    args.push_back("master");
283
    cmdstring += string(" ") + "master";
297
    args.push_back(dicPath());
284
    args.push_back(dicPath());
285
    cmdstring += string(" ") + dicPath();
298
286
299
    // Have to disable stderr, as numerous messages about bad strings are
287
    // Have to disable stderr, as numerous messages about bad strings are
300
    // printed. We'd like to keep errors about missing databases though, so
288
    // printed. We'd like to keep errors about missing databases though, so
301
    // make it configurable for diags
289
    // make it configurable for diags
302
    bool keepStderr = false;
290
    bool keepStderr = false;
...
...
326
        hasdict = true;
314
        hasdict = true;
327
        }
315
        }
328
    }
316
    }
329
    if (hasdict)
317
    if (hasdict)
330
        reason = string(
318
        reason = string(
331
      "\naspell dictionary creation command failed. Reason unknown.\n"
319
      "\naspell dictionary creation command [") +
320
                cmdstring + string("] failed. Reason unknown.\n"
332
        "Try to set aspellKeepStderr = 1 in recoll.conf, and execute \n"
321
        "Try to set aspellKeepStderr = 1 in recoll.conf, and execute \n"
333
        "the indexing command in a terminal to see the aspell "
322
        "the indexing command in a terminal to see the aspell "
334
        "diagnostic output.\n");
323
        "diagnostic output.\n");
335
    else
324
    else
336
        reason = string("aspell dictionary creation command failed.\n"
325
        reason = string("aspell dictionary creation command failed:\n") +
326
                cmdstring + "\n"
337
              "One possible reason might be missing language "
327
                "One possible reason might be missing language "
338
              "data files for lang = ") + m_lang;
328
                "data files for lang = " + m_lang +
329
                ". Maybe try to execute the command by hand for a better diag.";
339
    return false;
330
    return false;
340
    }
331
    }
341
    db.termWalkClose(tit);
332
    db.termWalkClose(tit);
342
    return true;
333
    return true;
343
}
334
}