From 3ce9d4db985cfc388984178ca5ee08ebe1d2b8be Mon Sep 17 00:00:00 2001 From: cxl Date: Sun, 27 Jan 2019 12:45:35 +0000 Subject: [PATCH] Core, ide: speller fixes git-svn-id: svn://ultimatepp.org/upp/trunk@12721 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/Speller.cpp | 12 +++++------- uppsrc/ide/Setup.cpp | 19 ++++++++++--------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/uppsrc/Core/Speller.cpp b/uppsrc/Core/Speller.cpp index 5ffe69c78..4d8b3f2c6 100644 --- a/uppsrc/Core/Speller.cpp +++ b/uppsrc/Core/Speller.cpp @@ -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 SpellerFindCloseWords(int lang, const String& w, int n) return r; } -}; \ No newline at end of file +}; diff --git a/uppsrc/ide/Setup.cpp b/uppsrc/ide/Setup.cpp index 946885756..b988cf878 100644 --- a/uppsrc/ide/Setup.cpp +++ b/uppsrc/ide/Setup.cpp @@ -338,19 +338,20 @@ void DlSpellerLangs(DropList& dl) static Vector lng; ONCELOCK { VectorMap 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 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);