+ string const thes_path = external_path(lyxrc.thesaurusdir_path);
+ LYXERR(Debug::FILES, "thesaurus path: " << thes_path);
+ if (thes_path.empty())
+ return make_pair(string(), string());
+
+ if (thesaurusAvailable(lang))
+ return make_pair(string(), string());
+
+ FileNameList const idx_files = FileName(thes_path).dirList("idx");
+ FileNameList const data_files = FileName(thes_path).dirList("dat");
+ string idx;
+ string data;
+
+ for (FileNameList::const_iterator it = idx_files.begin();
+ it != idx_files.end(); ++it) {
+ LYXERR(Debug::FILES, "found thesaurus idx file: " << it->onlyFileName());
+ if (contains(it->onlyFileName(), to_ascii(lang))) {
+ idx = it->absFilename();
+ LYXERR(Debug::FILES, "selected thesaurus idx file: " << idx);
+ break;
+ }
+ }
+
+ for (support::FileNameList::const_iterator it = data_files.begin();
+ it != data_files.end(); ++it) {
+ LYXERR(Debug::FILES, "found thesaurus data file: " << it->onlyFileName());
+ if (contains(it->onlyFileName(), to_ascii(lang))) {
+ data = it->absFilename();
+ LYXERR(Debug::FILES, "selected thesaurus data file: " << data);
+ break;
+ }
+ }
+
+ return make_pair(idx, data);