2012-02-20 21:47:14 +00:00
|
|
|
/* This file is (c) 2008-2012 Konstantin Isakov <ikm@goldendict.org>
|
2009-04-30 15:29:03 +00:00
|
|
|
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
|
|
|
|
|
|
|
|
#include "loaddictionaries.hh"
|
|
|
|
#include "initializing.hh"
|
|
|
|
#include "bgl.hh"
|
|
|
|
#include "stardict.hh"
|
|
|
|
#include "lsa.hh"
|
|
|
|
#include "dsl.hh"
|
|
|
|
#include "mediawiki.hh"
|
|
|
|
#include "sounddir.hh"
|
|
|
|
#include "hunspell.hh"
|
|
|
|
#include "dictdfiles.hh"
|
2009-05-06 14:39:08 +00:00
|
|
|
#include "romaji.hh"
|
|
|
|
#include "russiantranslit.hh"
|
2009-05-11 23:37:18 +00:00
|
|
|
#include "german.hh"
|
2010-05-29 09:22:08 +00:00
|
|
|
#include "greektranslit.hh"
|
2013-01-18 19:21:56 +00:00
|
|
|
#include "belarusiantranslit.hh"
|
2009-05-16 18:04:21 +00:00
|
|
|
#include "website.hh"
|
2010-06-12 20:16:35 +00:00
|
|
|
#include "forvo.hh"
|
2011-05-29 05:08:37 +00:00
|
|
|
#include "programs.hh"
|
2013-04-24 14:52:04 +00:00
|
|
|
#include "voiceengines.hh"
|
2013-11-16 18:34:09 +00:00
|
|
|
#include "gddebug.hh"
|
2011-09-09 12:05:28 +00:00
|
|
|
#include "fsencoding.hh"
|
2012-01-24 12:55:28 +00:00
|
|
|
#include "xdxf.hh"
|
2012-02-09 12:49:41 +00:00
|
|
|
#include "sdict.hh"
|
2012-02-09 12:50:38 +00:00
|
|
|
#include "aard.hh"
|
2012-09-28 12:39:52 +00:00
|
|
|
#include "zipsounds.hh"
|
2013-04-23 12:07:05 +00:00
|
|
|
#include "mdx.hh"
|
2013-09-14 16:17:32 +00:00
|
|
|
#include "zim.hh"
|
2014-04-30 12:55:53 +00:00
|
|
|
#include "dictserver.hh"
|
2015-01-22 15:17:05 +00:00
|
|
|
#include "slob.hh"
|
2009-04-30 15:29:03 +00:00
|
|
|
|
2014-05-20 13:59:56 +00:00
|
|
|
#ifndef NO_EPWING_SUPPORT
|
|
|
|
#include "epwing.hh"
|
|
|
|
#endif
|
|
|
|
|
2015-10-25 13:54:38 +00:00
|
|
|
#ifdef MAKE_CHINESE_CONVERSION_SUPPORT
|
2015-10-19 13:52:23 +00:00
|
|
|
#include "chinese.hh"
|
|
|
|
#endif
|
|
|
|
|
2009-04-30 15:29:03 +00:00
|
|
|
#include <QMessageBox>
|
|
|
|
#include <QDir>
|
|
|
|
|
|
|
|
#include <set>
|
|
|
|
|
|
|
|
using std::set;
|
|
|
|
|
|
|
|
using std::string;
|
|
|
|
using std::vector;
|
|
|
|
|
|
|
|
LoadDictionaries::LoadDictionaries( Config::Class const & cfg ):
|
2009-05-06 14:39:08 +00:00
|
|
|
paths( cfg.paths ), soundDirs( cfg.soundDirs ), hunspell( cfg.hunspell ),
|
2009-08-31 12:58:29 +00:00
|
|
|
transliteration( cfg.transliteration ),
|
2012-12-07 11:59:29 +00:00
|
|
|
exceptionText( "Load did not finish" ), // Will be cleared upon success
|
2013-01-11 09:58:14 +00:00
|
|
|
maxPictureWidth( cfg.maxPictureWidth ),
|
|
|
|
maxHeadwordSize( cfg.maxHeadwordSize )
|
2009-04-30 15:29:03 +00:00
|
|
|
{
|
2009-05-17 15:30:43 +00:00
|
|
|
// Populate name filters
|
|
|
|
|
|
|
|
nameFilters << "*.bgl" << "*.ifo" << "*.lsa" << "*.dat"
|
2012-02-09 12:49:41 +00:00
|
|
|
<< "*.dsl" << "*.dsl.dz" << "*.index" << "*.xdxf"
|
2013-04-23 12:07:05 +00:00
|
|
|
<< "*.xdxf.dz" << "*.dct" << "*.aar" << "*.zips"
|
2013-09-14 16:17:32 +00:00
|
|
|
<< "*.mdx"
|
|
|
|
#ifdef MAKE_ZIM_SUPPORT
|
2015-01-22 15:17:05 +00:00
|
|
|
<< "*.zim" << "*.zimaa" << "*.slob"
|
2013-09-14 16:17:32 +00:00
|
|
|
#endif
|
2014-05-20 13:59:56 +00:00
|
|
|
#ifndef NO_EPWING_SUPPORT
|
|
|
|
<< "*catalogs"
|
|
|
|
#endif
|
2013-09-14 16:17:32 +00:00
|
|
|
;
|
2009-04-30 15:29:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void LoadDictionaries::run()
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
for( Config::Paths::const_iterator i = paths.begin(); i != paths.end(); ++i )
|
|
|
|
handlePath( *i );
|
|
|
|
|
|
|
|
// Make soundDirs
|
|
|
|
{
|
|
|
|
vector< sptr< Dictionary::Class > > soundDirDictionaries =
|
2011-09-09 12:05:28 +00:00
|
|
|
SoundDir::makeDictionaries( soundDirs, FsEncoding::encode( Config::getIndexDir() ), *this );
|
2009-04-30 15:29:03 +00:00
|
|
|
|
|
|
|
dictionaries.insert( dictionaries.end(), soundDirDictionaries.begin(),
|
|
|
|
soundDirDictionaries.end() );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Make hunspells
|
|
|
|
{
|
|
|
|
vector< sptr< Dictionary::Class > > hunspellDictionaries =
|
|
|
|
HunspellMorpho::makeDictionaries( hunspell );
|
|
|
|
|
|
|
|
dictionaries.insert( dictionaries.end(), hunspellDictionaries.begin(),
|
|
|
|
hunspellDictionaries.end() );
|
|
|
|
}
|
2009-08-31 12:58:29 +00:00
|
|
|
|
|
|
|
exceptionText.clear();
|
2009-04-30 15:29:03 +00:00
|
|
|
}
|
|
|
|
catch( std::exception & e )
|
|
|
|
{
|
|
|
|
exceptionText = e.what();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void LoadDictionaries::handlePath( Config::Path const & path )
|
|
|
|
{
|
|
|
|
vector< string > allFiles;
|
|
|
|
|
|
|
|
QDir dir( path.path );
|
|
|
|
|
2009-05-17 15:30:43 +00:00
|
|
|
QFileInfoList entries = dir.entryInfoList( nameFilters, QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot );
|
2009-04-30 15:29:03 +00:00
|
|
|
|
|
|
|
for( QFileInfoList::const_iterator i = entries.constBegin();
|
|
|
|
i != entries.constEnd(); ++i )
|
|
|
|
{
|
|
|
|
QString fullName = i->canonicalFilePath();
|
|
|
|
|
|
|
|
if ( path.recursive && i->isDir() )
|
2009-05-17 15:37:36 +00:00
|
|
|
{
|
|
|
|
// Make sure the path doesn't look like with dsl resources
|
|
|
|
if ( !fullName.endsWith( ".dsl.files", Qt::CaseInsensitive ) &&
|
|
|
|
!fullName.endsWith( ".dsl.dz.files", Qt::CaseInsensitive ) )
|
|
|
|
handlePath( Config::Path( fullName, true ) );
|
|
|
|
}
|
2009-04-30 15:29:03 +00:00
|
|
|
|
2013-09-20 16:24:59 +00:00
|
|
|
if ( !i->isDir() )
|
|
|
|
allFiles.push_back( FsEncoding::encode( QDir::toNativeSeparators( fullName ) ) );
|
2009-04-30 15:29:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
vector< sptr< Dictionary::Class > > bglDictionaries =
|
2011-09-09 12:05:28 +00:00
|
|
|
Bgl::makeDictionaries( allFiles, FsEncoding::encode( Config::getIndexDir() ), *this );
|
2009-04-30 15:29:03 +00:00
|
|
|
|
|
|
|
dictionaries.insert( dictionaries.end(), bglDictionaries.begin(),
|
|
|
|
bglDictionaries.end() );
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
vector< sptr< Dictionary::Class > > stardictDictionaries =
|
2011-09-09 12:05:28 +00:00
|
|
|
Stardict::makeDictionaries( allFiles, FsEncoding::encode( Config::getIndexDir() ), *this );
|
2009-04-30 15:29:03 +00:00
|
|
|
|
|
|
|
dictionaries.insert( dictionaries.end(), stardictDictionaries.begin(),
|
|
|
|
stardictDictionaries.end() );
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
vector< sptr< Dictionary::Class > > lsaDictionaries =
|
2011-09-09 12:05:28 +00:00
|
|
|
Lsa::makeDictionaries( allFiles, FsEncoding::encode( Config::getIndexDir() ), *this );
|
2009-04-30 15:29:03 +00:00
|
|
|
|
|
|
|
dictionaries.insert( dictionaries.end(), lsaDictionaries.begin(),
|
|
|
|
lsaDictionaries.end() );
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
vector< sptr< Dictionary::Class > > dslDictionaries =
|
2013-01-11 09:58:14 +00:00
|
|
|
Dsl::makeDictionaries(
|
|
|
|
allFiles, FsEncoding::encode( Config::getIndexDir() ), *this, maxPictureWidth, maxHeadwordSize );
|
2009-04-30 15:29:03 +00:00
|
|
|
|
|
|
|
dictionaries.insert( dictionaries.end(), dslDictionaries.begin(),
|
|
|
|
dslDictionaries.end() );
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
vector< sptr< Dictionary::Class > > dictdDictionaries =
|
2011-09-09 12:05:28 +00:00
|
|
|
DictdFiles::makeDictionaries( allFiles, FsEncoding::encode( Config::getIndexDir() ), *this );
|
2009-04-30 15:29:03 +00:00
|
|
|
|
|
|
|
dictionaries.insert( dictionaries.end(), dictdDictionaries.begin(),
|
|
|
|
dictdDictionaries.end() );
|
|
|
|
}
|
2012-01-24 12:55:28 +00:00
|
|
|
{
|
|
|
|
vector< sptr< Dictionary::Class > > xdxfDictionaries =
|
|
|
|
Xdxf::makeDictionaries( allFiles, FsEncoding::encode( Config::getIndexDir() ), *this );
|
|
|
|
|
|
|
|
dictionaries.insert( dictionaries.end(), xdxfDictionaries.begin(),
|
|
|
|
xdxfDictionaries.end() );
|
|
|
|
}
|
2012-02-09 12:49:41 +00:00
|
|
|
{
|
|
|
|
vector< sptr< Dictionary::Class > > sdictDictionaries =
|
|
|
|
Sdict::makeDictionaries( allFiles, FsEncoding::encode( Config::getIndexDir() ), *this );
|
|
|
|
|
|
|
|
dictionaries.insert( dictionaries.end(), sdictDictionaries.begin(),
|
|
|
|
sdictDictionaries.end() );
|
|
|
|
}
|
2012-02-09 12:50:38 +00:00
|
|
|
{
|
|
|
|
vector< sptr< Dictionary::Class > > aardDictionaries =
|
|
|
|
Aard::makeDictionaries( allFiles, FsEncoding::encode( Config::getIndexDir() ), *this );
|
|
|
|
|
|
|
|
dictionaries.insert( dictionaries.end(), aardDictionaries.begin(),
|
|
|
|
aardDictionaries.end() );
|
|
|
|
}
|
2012-09-28 12:39:52 +00:00
|
|
|
{
|
|
|
|
vector< sptr< Dictionary::Class > > zipSoundsDictionaries =
|
|
|
|
ZipSounds::makeDictionaries( allFiles, FsEncoding::encode( Config::getIndexDir() ), *this );
|
|
|
|
|
|
|
|
dictionaries.insert( dictionaries.end(), zipSoundsDictionaries.begin(),
|
|
|
|
zipSoundsDictionaries.end() );
|
|
|
|
}
|
2013-04-23 12:07:05 +00:00
|
|
|
{
|
|
|
|
vector< sptr< Dictionary::Class > > mdxDictionaries =
|
|
|
|
Mdx::makeDictionaries( allFiles, FsEncoding::encode( Config::getIndexDir() ), *this );
|
|
|
|
|
|
|
|
dictionaries.insert( dictionaries.end(), mdxDictionaries.begin(),
|
|
|
|
mdxDictionaries.end() );
|
|
|
|
}
|
2013-09-14 16:17:32 +00:00
|
|
|
#ifdef MAKE_ZIM_SUPPORT
|
|
|
|
{
|
|
|
|
vector< sptr< Dictionary::Class > > zimDictionaries =
|
|
|
|
Zim::makeDictionaries( allFiles, FsEncoding::encode( Config::getIndexDir() ), *this );
|
|
|
|
|
|
|
|
dictionaries.insert( dictionaries.end(), zimDictionaries.begin(),
|
|
|
|
zimDictionaries.end() );
|
|
|
|
}
|
2015-01-22 15:17:05 +00:00
|
|
|
{
|
|
|
|
vector< sptr< Dictionary::Class > > slobDictionaries =
|
|
|
|
Slob::makeDictionaries( allFiles, FsEncoding::encode( Config::getIndexDir() ), *this );
|
|
|
|
|
|
|
|
dictionaries.insert( dictionaries.end(), slobDictionaries.begin(),
|
|
|
|
slobDictionaries.end() );
|
|
|
|
}
|
2013-09-14 16:17:32 +00:00
|
|
|
#endif
|
2014-05-20 13:59:56 +00:00
|
|
|
#ifndef NO_EPWING_SUPPORT
|
|
|
|
{
|
|
|
|
vector< sptr< Dictionary::Class > > epwingDictionaries =
|
|
|
|
Epwing::makeDictionaries( allFiles, FsEncoding::encode( Config::getIndexDir() ), *this );
|
|
|
|
|
|
|
|
dictionaries.insert( dictionaries.end(), epwingDictionaries.begin(),
|
|
|
|
epwingDictionaries.end() );
|
|
|
|
}
|
|
|
|
#endif
|
2009-04-30 15:29:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void LoadDictionaries::indexingDictionary( string const & dictionaryName ) throw()
|
|
|
|
{
|
|
|
|
emit indexingDictionarySignal( QString::fromUtf8( dictionaryName.c_str() ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void loadDictionaries( QWidget * parent, bool showInitially,
|
|
|
|
Config::Class const & cfg,
|
|
|
|
std::vector< sptr< Dictionary::Class > > & dictionaries,
|
2009-05-17 22:02:54 +00:00
|
|
|
QNetworkAccessManager & dictNetMgr,
|
|
|
|
bool doDeferredInit_ )
|
2009-04-30 15:29:03 +00:00
|
|
|
{
|
|
|
|
dictionaries.clear();
|
2009-05-06 18:17:13 +00:00
|
|
|
|
2009-04-30 15:29:03 +00:00
|
|
|
::Initializing init( parent, showInitially );
|
|
|
|
|
|
|
|
// Start a thread to load all the dictionaries
|
|
|
|
|
|
|
|
LoadDictionaries loadDicts( cfg );
|
|
|
|
|
|
|
|
QObject::connect( &loadDicts, SIGNAL( indexingDictionarySignal( QString const & ) ),
|
|
|
|
&init, SLOT( indexing( QString const & ) ) );
|
|
|
|
|
|
|
|
QEventLoop localLoop;
|
|
|
|
|
|
|
|
QObject::connect( &loadDicts, SIGNAL( finished() ),
|
|
|
|
&localLoop, SLOT( quit() ) );
|
|
|
|
|
|
|
|
loadDicts.start();
|
|
|
|
|
|
|
|
localLoop.exec();
|
|
|
|
|
|
|
|
loadDicts.wait();
|
|
|
|
|
|
|
|
if ( loadDicts.getExceptionText().size() )
|
|
|
|
{
|
|
|
|
QMessageBox::critical( parent, QCoreApplication::translate( "LoadDictionaries", "Error loading dictionaries" ),
|
|
|
|
QString::fromUtf8( loadDicts.getExceptionText().c_str() ) );
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
dictionaries = loadDicts.getDictionaries();
|
|
|
|
|
2009-05-18 10:46:53 +00:00
|
|
|
///// We create transliterations syncronously since they are very simple
|
|
|
|
|
2015-10-25 13:54:38 +00:00
|
|
|
#ifdef MAKE_CHINESE_CONVERSION_SUPPORT
|
2015-10-19 13:52:23 +00:00
|
|
|
// Make Chinese conversion
|
|
|
|
{
|
|
|
|
vector< sptr< Dictionary::Class > > chineseDictionaries =
|
|
|
|
Chinese::makeDictionaries( cfg.transliteration.chinese );
|
|
|
|
|
|
|
|
dictionaries.insert( dictionaries.end(), chineseDictionaries.begin(),
|
|
|
|
chineseDictionaries.end() );
|
|
|
|
}
|
2015-10-25 13:54:38 +00:00
|
|
|
#endif
|
2015-10-19 13:52:23 +00:00
|
|
|
|
2009-05-18 10:46:53 +00:00
|
|
|
// Make Romaji
|
|
|
|
{
|
|
|
|
vector< sptr< Dictionary::Class > > romajiDictionaries =
|
|
|
|
Romaji::makeDictionaries( cfg.transliteration.romaji );
|
|
|
|
|
|
|
|
dictionaries.insert( dictionaries.end(), romajiDictionaries.begin(),
|
|
|
|
romajiDictionaries.end() );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Make Russian transliteration
|
|
|
|
if ( cfg.transliteration.enableRussianTransliteration )
|
|
|
|
dictionaries.push_back( RussianTranslit::makeDictionary() );
|
|
|
|
|
|
|
|
// Make German transliteration
|
|
|
|
if ( cfg.transliteration.enableGermanTransliteration )
|
|
|
|
dictionaries.push_back( GermanTranslit::makeDictionary() );
|
|
|
|
|
2010-05-29 09:22:08 +00:00
|
|
|
// Make Greek transliteration
|
|
|
|
if ( cfg.transliteration.enableGreekTransliteration )
|
|
|
|
dictionaries.push_back( GreekTranslit::makeDictionary() );
|
|
|
|
|
2013-01-18 19:21:56 +00:00
|
|
|
// Make Belarusian transliteration
|
|
|
|
if ( cfg.transliteration.enableBelarusianTransliteration )
|
|
|
|
{
|
|
|
|
vector< sptr< Dictionary::Class > > dicts = BelarusianTranslit::makeDictionaries();
|
|
|
|
dictionaries.insert( dictionaries.end(), dicts.begin(), dicts.end() );
|
|
|
|
}
|
|
|
|
|
2009-04-30 15:29:03 +00:00
|
|
|
///// We create MediaWiki dicts syncronously, since they use netmgr
|
|
|
|
|
|
|
|
{
|
|
|
|
vector< sptr< Dictionary::Class > > dicts =
|
|
|
|
MediaWiki::makeDictionaries( loadDicts, cfg.mediawikis, dictNetMgr );
|
|
|
|
|
|
|
|
dictionaries.insert( dictionaries.end(), dicts.begin(), dicts.end() );
|
|
|
|
}
|
|
|
|
|
2009-05-16 18:04:21 +00:00
|
|
|
///// WebSites are very simple, no need to create them asyncronously
|
|
|
|
{
|
|
|
|
vector< sptr< Dictionary::Class > > dicts =
|
|
|
|
WebSite::makeDictionaries( cfg.webSites );
|
|
|
|
|
|
|
|
dictionaries.insert( dictionaries.end(), dicts.begin(), dicts.end() );
|
|
|
|
}
|
|
|
|
|
2010-06-12 20:16:35 +00:00
|
|
|
//// Forvo dictionaries
|
|
|
|
|
|
|
|
{
|
|
|
|
vector< sptr< Dictionary::Class > > dicts =
|
|
|
|
Forvo::makeDictionaries( loadDicts, cfg.forvo, dictNetMgr );
|
|
|
|
|
|
|
|
dictionaries.insert( dictionaries.end(), dicts.begin(), dicts.end() );
|
|
|
|
}
|
|
|
|
|
2011-05-29 05:08:37 +00:00
|
|
|
//// Programs
|
|
|
|
{
|
|
|
|
vector< sptr< Dictionary::Class > > dicts =
|
|
|
|
Programs::makeDictionaries( cfg.programs );
|
|
|
|
|
|
|
|
dictionaries.insert( dictionaries.end(), dicts.begin(), dicts.end() );
|
|
|
|
}
|
|
|
|
|
2013-04-24 14:52:04 +00:00
|
|
|
//// Text to Speech
|
|
|
|
{
|
|
|
|
vector< sptr< Dictionary::Class > > dicts =
|
|
|
|
VoiceEngines::makeDictionaries( cfg.voiceEngines );
|
|
|
|
|
|
|
|
dictionaries.insert( dictionaries.end(), dicts.begin(), dicts.end() );
|
|
|
|
}
|
|
|
|
|
2014-04-30 12:55:53 +00:00
|
|
|
{
|
|
|
|
vector< sptr< Dictionary::Class > > dicts =
|
|
|
|
DictServer::makeDictionaries( cfg.dictServers );
|
|
|
|
|
|
|
|
dictionaries.insert( dictionaries.end(), dicts.begin(), dicts.end() );
|
|
|
|
}
|
|
|
|
|
2014-05-10 21:02:31 +00:00
|
|
|
GD_DPRINTF( "Load done\n" );
|
2009-05-17 13:35:19 +00:00
|
|
|
|
2009-04-30 15:29:03 +00:00
|
|
|
// Remove any stale index files
|
|
|
|
|
|
|
|
set< string > ids;
|
2013-11-16 19:03:36 +00:00
|
|
|
std::pair< std::set< string >::iterator, bool > ret;
|
|
|
|
|
|
|
|
QTextCodec::setCodecForCStrings( QTextCodec::codecForName( "UTF8" ) );
|
2009-04-30 15:29:03 +00:00
|
|
|
|
|
|
|
for( unsigned x = dictionaries.size(); x--; )
|
2013-11-16 19:03:36 +00:00
|
|
|
{
|
|
|
|
ret = ids.insert( dictionaries[ x ]->getId() );
|
|
|
|
if( !ret.second )
|
|
|
|
{
|
|
|
|
gdWarning( "Duplicate dictionary ID found: ID=%s, name=\"%s\", path=\"%s\"",
|
|
|
|
dictionaries[ x ]->getId().c_str(),
|
|
|
|
dictionaries[ x ]->getName().c_str(),
|
|
|
|
dictionaries[ x ]->getDictionaryFilenames().empty() ?
|
|
|
|
"" : dictionaries[ x ]->getDictionaryFilenames()[ 0 ].c_str()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2009-04-30 15:29:03 +00:00
|
|
|
|
|
|
|
QDir indexDir( Config::getIndexDir() );
|
|
|
|
|
|
|
|
QStringList allIdxFiles = indexDir.entryList( QDir::Files );
|
|
|
|
|
|
|
|
for( QStringList::const_iterator i = allIdxFiles.constBegin();
|
|
|
|
i != allIdxFiles.constEnd(); ++i )
|
|
|
|
{
|
2014-04-25 13:16:42 +00:00
|
|
|
if ( ids.find( FsEncoding::encode( *i ) ) == ids.end()
|
|
|
|
&& i->size() == 32 )
|
|
|
|
indexDir.remove( *i );
|
|
|
|
else
|
|
|
|
if ( i->endsWith( "_FTS" )
|
|
|
|
&& i->size() == 36
|
|
|
|
&& ids.find( FsEncoding::encode( i->left( 32 ) ) ) == ids.end() )
|
2009-04-30 15:29:03 +00:00
|
|
|
indexDir.remove( *i );
|
|
|
|
}
|
2009-05-17 13:35:19 +00:00
|
|
|
|
|
|
|
// Run deferred inits
|
|
|
|
|
2009-05-17 22:02:54 +00:00
|
|
|
if ( doDeferredInit_ )
|
|
|
|
doDeferredInit( dictionaries );
|
|
|
|
}
|
|
|
|
|
|
|
|
void doDeferredInit( std::vector< sptr< Dictionary::Class > > & dictionaries )
|
|
|
|
{
|
2009-05-17 13:35:19 +00:00
|
|
|
for( unsigned x = 0; x < dictionaries.size(); ++x )
|
|
|
|
dictionaries[ x ]->deferredInit();
|
2009-04-30 15:29:03 +00:00
|
|
|
}
|