Skip to content

Commit

Permalink
Merge pull request #1876 from xiaoyifang/fix/mdx-empty-title
Browse files Browse the repository at this point in the history
fix: [mdx] use file name as  dictionary name when title has not been set
  • Loading branch information
xiaoyifang authored Oct 28, 2024
2 parents 15207cf + 2ca5568 commit 12dbfb5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/dict/mdx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down

0 comments on commit 12dbfb5

Please sign in to comment.