mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
+ Allow the "file.dsl.files.zip" naming scheme for file.dsl.dz files.
The old one, "file.dsl.dz.files.zip" still works too.
This commit is contained in:
parent
769ff4d2a1
commit
356570b244
16
src/dsl.cc
16
src/dsl.cc
|
@ -354,8 +354,22 @@ void DslDictionary::doDeferredInit()
|
|||
idxHeader.indexRootOffset ),
|
||||
idx, idxMutex );
|
||||
|
||||
string const & dictionaryFilename = getDictionaryFilenames()[ 0 ];
|
||||
|
||||
// Open a resource zip file, if there's one
|
||||
resourceZip = zip_open( ( getDictionaryFilenames()[ 0 ] + ".files.zip" ).c_str(), 0, 0 );
|
||||
resourceZip = zip_open( ( dictionaryFilename + ".files.zip" ).c_str(), 0, 0 );
|
||||
|
||||
|
||||
// If failed, try without the .dz extension
|
||||
if ( !resourceZip && dictionaryFilename.size() >= 3 &&
|
||||
( !dictionaryFilename.compare( dictionaryFilename.size() - 3, 3, ".dz" ) ||
|
||||
!dictionaryFilename.compare( dictionaryFilename.size() - 3, 3, ".DZ" )
|
||||
)
|
||||
)
|
||||
{
|
||||
resourceZip = zip_open(
|
||||
( dictionaryFilename.substr( 0, dictionaryFilename.size() - 3 ) + ".files.zip" ).c_str(), 0, 0 );
|
||||
}
|
||||
}
|
||||
catch( std::exception & e )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue