mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +00:00
more correct check of thesaurus file format
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34760 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
8cc770423d
commit
598d185ada
@ -100,9 +100,16 @@ pair<string,string> Thesaurus::Private::getThesaurus(string const & path, docstr
|
||||
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) {
|
||||
// check for appropriate version of index file
|
||||
string encoding; // first line is encoding
|
||||
int items = 0; // second line is no. of items
|
||||
getline(ifs,encoding);
|
||||
ifs >> items;
|
||||
if (ifs.fail()) {
|
||||
LYXERR(Debug::FILES, "ignore irregular thesaurus idx file: " << it->absFileName());
|
||||
continue;
|
||||
}
|
||||
if (encoding.length() == 0 || encoding.find_first_of(',') != string::npos) {
|
||||
LYXERR(Debug::FILES, "ignore version1 thesaurus idx file: " << it->absFileName());
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user