mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
Merge pull request #1876 from xiaoyifang/fix/mdx-empty-title
Some checks are pending
SonarCloud / Build and analyze (push) Waiting to run
Some checks are pending
SonarCloud / Build and analyze (push) Waiting to run
fix: [mdx] use file name as dictionary name when title has not been set
This commit is contained in:
commit
12dbfb5423
|
@ -317,6 +317,12 @@ MdxDictionary::MdxDictionary( string const & id, string const & indexFile, vecto
|
|||
dictionaryName = string( &buf.front(), len );
|
||||
}
|
||||
|
||||
//fallback, use filename as dictionary name
|
||||
if ( dictionaryName.empty() ) {
|
||||
QFileInfo f( QString::fromUtf8( dictionaryFiles[ 0 ].c_str() ) );
|
||||
dictionaryName = f.baseName().toStdString();
|
||||
}
|
||||
|
||||
// then read the dictionary's encoding
|
||||
len = idx.read< uint32_t >();
|
||||
if ( len > 0 ) {
|
||||
|
|
Loading…
Reference in a new issue