+ 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:
Konstantin Isakov 2009-10-09 13:58:58 +00:00
parent 769ff4d2a1
commit 356570b244

View file

@ -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 )
{