+
+ LangPersonalWordList::const_iterator pdit = personal_.begin();
+ LangPersonalWordList::const_iterator pdet = personal_.end();
+
+ for (; pdit != pdet; ++pdit) {
+ if (0 == pdit->second)
+ continue;
+ PersonalWordList * pd = pdit->second;
+ pd->save();
+ delete pd;
+ }
+}
+
+
+bool AspellChecker::Private::isValidDictionary(AspellConfig * config,
+ string const & lang, string const & variety)
+{
+ bool have = false;
+ // code taken from aspell's list-dicts example
+ // the returned pointer should _not_ need to be deleted
+ AspellDictInfoList * dlist = get_aspell_dict_info_list(config);
+ AspellDictInfoEnumeration * dels = aspell_dict_info_list_elements(dlist);
+ const AspellDictInfo * entry;
+
+ while (0 != (entry = aspell_dict_info_enumeration_next(dels))) {
+ LYXERR(Debug::DEBUG, "aspell dict:"
+ << " name=" << entry->name
+ << ",code=" << entry->code
+ << ",variety=" << entry->jargon);
+ if (entry->code == lang && (variety.empty() || entry->jargon == variety)) {
+ have = true;
+ break;
+ }
+ }
+ delete_aspell_dict_info_enumeration(dels);
+ LYXERR(Debug::FILES, "aspell dictionary: " << lang << (have ? " yes" : " no"));
+ return have;
+}
+
+
+bool AspellChecker::Private::checkAspellData(AspellConfig * config,
+ string const & basepath, string const & datapath, string const & dictpath,
+ string const & lang, string const & variety)
+{
+ FileName base(basepath);
+ bool have_dict = base.isDirectory();
+
+ if (have_dict) {
+ FileName data(addPath(base.absFileName(), datapath));
+ FileName dict(addPath(base.absFileName(), dictpath));
+ have_dict = dict.isDirectory() && data.isDirectory();
+ if (have_dict) {
+ LYXERR(Debug::FILES, "aspell dict-dir: " << dict);
+ LYXERR(Debug::FILES, "aspell data-dir: " << data);
+ aspell_config_replace(config, "dict-dir", dict.absFileName().c_str());
+ aspell_config_replace(config, "data-dir", data.absFileName().c_str());
+ have_dict = isValidDictionary(config, lang, variety);
+ }
+ }
+ return have_dict;