mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-19 06:06:54 -06:00
Core, ide: speller fixes
git-svn-id: svn://ultimatepp.org/upp/trunk@12721 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
fd0c393451
commit
3ce9d4db98
2 changed files with 15 additions and 16 deletions
|
|
@ -146,15 +146,13 @@ Speller *sGetSpeller(int lang)
|
|||
int q = speller.Find(lang);
|
||||
if(q < 0) {
|
||||
String pp = spell_path;
|
||||
DoSpellerPath(pp, GetExeDirFile("scd"));
|
||||
DoSpellerPath(pp, ConfigFile("scd"));
|
||||
DoSpellerPath(pp, GetExeDirFile("speller"));
|
||||
DoSpellerPath(pp, ConfigFile("speller"));
|
||||
pp << spell_path << ';' << getenv("LIB") << ';' << getenv("PATH") << ';';
|
||||
#ifdef PLATFORM_POSIX
|
||||
pp << "/usr/share/upp;/usr/local/share/upp;/usr/share/upp/scd;/usr/local/share/upp/scd";
|
||||
pp << "/usr/local/share/upp/speller;/usr/local/share/upp;/usr/share/upp/speller;/usr/share/upp";
|
||||
#endif
|
||||
String path = GetFileOnPath(ToLower(LNGAsText(lang)) + ".udc", pp);
|
||||
if(IsNull(path))
|
||||
path = GetFileOnPath(ToLower(LNGAsText(lang)) + ".scd", pp);
|
||||
if(IsNull(path))
|
||||
return NULL;
|
||||
FileIn in(path);
|
||||
|
|
@ -173,7 +171,7 @@ Speller *sGetSpeller(int lang)
|
|||
else {
|
||||
f.path = path;
|
||||
int n = in.Get32();
|
||||
LLOG("Found scd file " << path << " blocks " << n);
|
||||
LLOG("Found dictionary file " << path << " blocks " << n);
|
||||
if(n > 0 && n < 100000) {
|
||||
for(int i = 0; i < n; i++) {
|
||||
SpellBlock& b = f.block.Add();
|
||||
|
|
@ -430,4 +428,4 @@ Vector<String> SpellerFindCloseWords(int lang, const String& w, int n)
|
|||
return r;
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -338,19 +338,20 @@ void DlSpellerLangs(DropList& dl)
|
|||
static Vector<int> lng;
|
||||
ONCELOCK {
|
||||
VectorMap<int, String> lngs;
|
||||
String path = GetExeDirFile("scd") + ';' + ConfigFile("scd") + ';' +
|
||||
String path = GetExeDirFile("speller") + ';' + ConfigFile("speller") + ';' +
|
||||
GetExeFolder() + ';' + GetConfigFolder() + ';' +
|
||||
getenv("LIB") + ';' + getenv("PATH");
|
||||
#ifdef PLATFORM_POSIX
|
||||
path << "/usr/local/share/upp/speller;/usr/local/share/upp;/usr/share/upp/speller;/usr/share/upp";
|
||||
#endif
|
||||
Vector<String> p = Split(path, ';');
|
||||
for(auto dir : p) {
|
||||
for(int pass = 0; pass < 2; pass++) {
|
||||
FindFile ff(AppendFileName(dir, pass ? "*.udc" : "*.scd"));
|
||||
while(ff) {
|
||||
int lang = LNGFromText(ff.GetName());
|
||||
if(lang)
|
||||
lngs.Add(lang, LNGAsText(lang));
|
||||
ff.Next();
|
||||
}
|
||||
FindFile ff(AppendFileName(dir, "*.udc"));
|
||||
while(ff) {
|
||||
int lang = LNGFromText(ff.GetName());
|
||||
if(lang)
|
||||
lngs.Add(lang, LNGAsText(lang));
|
||||
ff.Next();
|
||||
}
|
||||
}
|
||||
SortByValue(lngs);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue