mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
parent
2e6cf12d78
commit
0759259b76
|
@ -131,14 +131,6 @@ void LoadDictionaries::handlePath( Config::Path const & path )
|
||||||
allFiles.push_back( FsEncoding::encode( QDir::toNativeSeparators( fullName ) ) );
|
allFiles.push_back( FsEncoding::encode( QDir::toNativeSeparators( fullName ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
vector< sptr< Dictionary::Class > > mdxDictionaries =
|
|
||||||
Mdx::makeDictionaries( allFiles, FsEncoding::encode( Config::getIndexDir() ), *this );
|
|
||||||
|
|
||||||
dictionaries.insert( dictionaries.end(), mdxDictionaries.begin(),
|
|
||||||
mdxDictionaries.end() );
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
vector< sptr< Dictionary::Class > > bglDictionaries =
|
vector< sptr< Dictionary::Class > > bglDictionaries =
|
||||||
Bgl::makeDictionaries( allFiles, FsEncoding::encode( Config::getIndexDir() ), *this );
|
Bgl::makeDictionaries( allFiles, FsEncoding::encode( Config::getIndexDir() ), *this );
|
||||||
|
@ -207,6 +199,13 @@ void LoadDictionaries::handlePath( Config::Path const & path )
|
||||||
dictionaries.insert( dictionaries.end(), zipSoundsDictionaries.begin(),
|
dictionaries.insert( dictionaries.end(), zipSoundsDictionaries.begin(),
|
||||||
zipSoundsDictionaries.end() );
|
zipSoundsDictionaries.end() );
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
vector< sptr< Dictionary::Class > > mdxDictionaries =
|
||||||
|
Mdx::makeDictionaries( allFiles, FsEncoding::encode( Config::getIndexDir() ), *this );
|
||||||
|
|
||||||
|
dictionaries.insert( dictionaries.end(), mdxDictionaries.begin(),
|
||||||
|
mdxDictionaries.end() );
|
||||||
|
}
|
||||||
{
|
{
|
||||||
vector< sptr< Dictionary::Class > > glsDictionaries =
|
vector< sptr< Dictionary::Class > > glsDictionaries =
|
||||||
Gls::makeDictionaries( allFiles, FsEncoding::encode( Config::getIndexDir() ), *this );
|
Gls::makeDictionaries( allFiles, FsEncoding::encode( Config::getIndexDir() ), *this );
|
||||||
|
|
9
mdx.cc
9
mdx.cc
|
@ -1455,21 +1455,18 @@ static void findResourceFiles( string const & mdx, vector< string > & dictFiles
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > & fileNames,
|
vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & fileNames,
|
||||||
string const & indicesDir,
|
string const & indicesDir,
|
||||||
Dictionary::Initializing & initializing )
|
Dictionary::Initializing & initializing )
|
||||||
{
|
{
|
||||||
vector< sptr< Dictionary::Class > > dictionaries;
|
vector< sptr< Dictionary::Class > > dictionaries;
|
||||||
|
|
||||||
for ( vector< string >::iterator i = fileNames.begin(); i != fileNames.end(); )
|
for ( vector< string >::const_iterator i = fileNames.begin(); i != fileNames.end(); ++i )
|
||||||
{
|
{
|
||||||
// Skip files with the extensions different to .mdx to speed up the
|
// Skip files with the extensions different to .mdx to speed up the
|
||||||
// scanning
|
// scanning
|
||||||
if ( i->size() < 4 || strcasecmp( i->c_str() + ( i->size() - 4 ), ".mdx" ) != 0 )
|
if ( i->size() < 4 || strcasecmp( i->c_str() + ( i->size() - 4 ), ".mdx" ) != 0 )
|
||||||
{
|
|
||||||
i++;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
vector< string > dictFiles( 1, *i );
|
vector< string > dictFiles( 1, *i );
|
||||||
findResourceFiles( *i, dictFiles );
|
findResourceFiles( *i, dictFiles );
|
||||||
|
@ -1656,8 +1653,6 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > & fileNam
|
||||||
}
|
}
|
||||||
|
|
||||||
dictionaries.push_back( new MdxDictionary( dictId, indexFile, dictFiles ) );
|
dictionaries.push_back( new MdxDictionary( dictId, indexFile, dictFiles ) );
|
||||||
|
|
||||||
i=fileNames.erase(i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return dictionaries;
|
return dictionaries;
|
||||||
|
|
2
mdx.hh
2
mdx.hh
|
@ -12,7 +12,7 @@ namespace Mdx
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > & fileNames,
|
vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & fileNames,
|
||||||
string const & indicesDir,
|
string const & indicesDir,
|
||||||
Dictionary::Initializing & ) ;
|
Dictionary::Initializing & ) ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue