Add lookup for standard location of hunspell dictionaries of Debian packages

This commit is contained in:
Stephan Witt 2014-11-18 08:56:23 +01:00
parent 5c90303c0a
commit 2992bb04da

View File

@ -83,15 +83,18 @@ struct HunspellChecker::Private
/// the location below system/user directory /// the location below system/user directory
/// there the aff+dic files lookup will happen /// there the aff+dic files lookup will happen
const string dictDirectory(void) const { return "dicts"; } const string dictDirectory(void) const { return "dicts"; }
int maxLookupSelector(void) const { return 4; } int maxLookupSelector(void) const { return 5; }
const string HunspellDictionaryName(Language const * lang) { const string HunspellDictionaryName(Language const * lang) {
return lang->variety().empty() return lang->variety().empty()
? lang->code() ? lang->code()
: lang->code() + "-" + lang->variety(); : lang->code() + "-" + lang->variety();
} }
const string osPackageDictDirectory(void) { const string myspellPackageDictDirectory(void) {
return "/usr/share/myspell"; return "/usr/share/myspell";
} }
const string hunspellPackageDictDirectory(void) {
return "/usr/share/hunspell";
}
}; };
@ -150,15 +153,14 @@ bool HunspellChecker::Private::haveLanguageFiles(string const & hpath)
const string HunspellChecker::Private::dictPath(int selector) const string HunspellChecker::Private::dictPath(int selector)
{ {
switch (selector) { switch (selector) {
case 4:
return addName(hunspellPackageDictDirectory(),dictDirectory());
case 3: case 3:
return addName(osPackageDictDirectory(),dictDirectory()); return addName(myspellPackageDictDirectory(),dictDirectory());
break;
case 2: case 2:
return addName(package().system_support().absFileName(),dictDirectory()); return addName(package().system_support().absFileName(),dictDirectory());
break;
case 1: case 1:
return addName(package().user_support().absFileName(),dictDirectory()); return addName(package().user_support().absFileName(),dictDirectory());
break;
default: default:
return user_path_; return user_path_;
} }