mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-08 18:19:42 +00:00
add check for version 1 index files - skip them if present
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34750 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
55afdeb980
commit
333485fa34
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace lyx::support;
|
using namespace lyx::support;
|
||||||
@ -91,10 +92,21 @@ pair<string,string> Thesaurus::Private::getThesaurus(string const & path, docstr
|
|||||||
FileNameList const data_files = base.dirList("dat");
|
FileNameList const data_files = base.dirList("dat");
|
||||||
string idx;
|
string idx;
|
||||||
string data;
|
string data;
|
||||||
|
string basename;
|
||||||
|
|
||||||
LYXERR(Debug::FILES, "thesaurus path: " << path);
|
LYXERR(Debug::FILES, "thesaurus path: " << path);
|
||||||
for (FileNameList::const_iterator it = idx_files.begin(); it != idx_files.end(); ++it) {
|
for (FileNameList::const_iterator it = idx_files.begin(); it != idx_files.end(); ++it) {
|
||||||
if (contains(it->onlyFileName(), to_ascii(lang))) {
|
basename = it->onlyFileNameWithoutExt();
|
||||||
|
if (contains(basename, to_ascii(lang))) {
|
||||||
|
ifstream ifs(it->absFileName().c_str());
|
||||||
|
if (ifs) {
|
||||||
|
string s;
|
||||||
|
getline(ifs,s);
|
||||||
|
if (s.find_first_of(',') != string::npos) {
|
||||||
|
LYXERR(Debug::FILES, "ignore version1 thesaurus idx file: " << it->absFileName());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
idx = it->absFileName();
|
idx = it->absFileName();
|
||||||
LYXERR(Debug::FILES, "selected thesaurus idx file: " << idx);
|
LYXERR(Debug::FILES, "selected thesaurus idx file: " << idx);
|
||||||
break;
|
break;
|
||||||
@ -104,7 +116,7 @@ pair<string,string> Thesaurus::Private::getThesaurus(string const & path, docstr
|
|||||||
return make_pair(string(), string());
|
return make_pair(string(), string());
|
||||||
}
|
}
|
||||||
for (support::FileNameList::const_iterator it = data_files.begin(); it != data_files.end(); ++it) {
|
for (support::FileNameList::const_iterator it = data_files.begin(); it != data_files.end(); ++it) {
|
||||||
if (contains(it->onlyFileName(), to_ascii(lang))) {
|
if (contains(it->onlyFileName(), basename)) {
|
||||||
data = it->absFileName();
|
data = it->absFileName();
|
||||||
LYXERR(Debug::FILES, "selected thesaurus data file: " << data);
|
LYXERR(Debug::FILES, "selected thesaurus data file: " << data);
|
||||||
break;
|
break;
|
||||||
@ -164,6 +176,8 @@ bool Thesaurus::thesaurusAvailable(docstring const & lang) const
|
|||||||
|
|
||||||
bool Thesaurus::thesaurusInstalled(docstring const & lang) const
|
bool Thesaurus::thesaurusInstalled(docstring const & lang) const
|
||||||
{
|
{
|
||||||
|
if (thesaurusAvailable(lang))
|
||||||
|
return true;
|
||||||
pair<string, string> files = d->getThesaurus(lang);
|
pair<string, string> files = d->getThesaurus(lang);
|
||||||
return (!files.first.empty() && !files.second.empty());
|
return (!files.first.empty() && !files.second.empty());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user