mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
opt: unify dictionaryid generation
This commit is contained in:
parent
f91100ca9a
commit
0b5f64d291
|
@ -509,26 +509,16 @@ string makeDictionaryId( vector< string > const & dictionaryFiles ) noexcept
|
||||||
{
|
{
|
||||||
std::vector< string > sortedList;
|
std::vector< string > sortedList;
|
||||||
|
|
||||||
if ( Config::isPortableVersion() ) {
|
|
||||||
// For portable version, we use relative paths
|
// use filename to unify the calculation step
|
||||||
sortedList.reserve( dictionaryFiles.size() );
|
sortedList.reserve( dictionaryFiles.size() );
|
||||||
|
|
||||||
const QDir dictionariesDir( Config::getPortableVersionDictionaryDir() );
|
|
||||||
|
|
||||||
for ( const auto & full : dictionaryFiles ) {
|
for ( const auto & full : dictionaryFiles ) {
|
||||||
QFileInfo fileInfo( QString::fromStdString( full ) );
|
QFileInfo fileInfo( QString::fromStdString( full ) );
|
||||||
|
sortedList.push_back( fileInfo.fileName().toStdString() );
|
||||||
if ( fileInfo.isAbsolute() )
|
|
||||||
sortedList.push_back( dictionariesDir.relativeFilePath( fileInfo.filePath() ).toStdString() );
|
|
||||||
else {
|
|
||||||
// Well, it's relative. We don't technically support those, but
|
|
||||||
// what the heck
|
|
||||||
sortedList.push_back( full );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
sortedList = dictionaryFiles;
|
|
||||||
|
|
||||||
std::sort( sortedList.begin(), sortedList.end() );
|
std::sort( sortedList.begin(), sortedList.end() );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue