mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24:05 +00:00
xapian remove obsolete ftx index
This commit is contained in:
parent
46b8969666
commit
1ad358bb84
|
@ -428,6 +428,7 @@ SOURCES += folding.cc \
|
|||
btreeidx.cc \
|
||||
stardict.cc \
|
||||
chunkedstorage.cc \
|
||||
utils.cc \
|
||||
weburlrequestinterceptor.cpp \
|
||||
xdxf2html.cc \
|
||||
iconv.cc \
|
||||
|
|
|
@ -397,19 +397,24 @@ void loadDictionaries( QWidget * parent, bool showInitially,
|
|||
|
||||
QDir indexDir( Config::getIndexDir() );
|
||||
|
||||
QStringList allIdxFiles = indexDir.entryList( QDir::Files );
|
||||
QStringList allIdxFiles = indexDir.entryList( QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks );
|
||||
|
||||
for( QStringList::const_iterator i = allIdxFiles.constBegin();
|
||||
i != allIdxFiles.constEnd(); ++i )
|
||||
for( QStringList::const_iterator i = allIdxFiles.constBegin(); i != allIdxFiles.constEnd(); ++i )
|
||||
{
|
||||
if( i->size() >= 32 && ids.find( FsEncoding::encode( i->left( 32 ) ) ) == ids.end() )
|
||||
{
|
||||
if( QFile::exists( *i ) )
|
||||
{
|
||||
if ( ids.find( FsEncoding::encode( *i ) ) == ids.end()
|
||||
&& i->size() == 32 )
|
||||
indexDir.remove( *i );
|
||||
}
|
||||
else
|
||||
if ( i->endsWith( "_FTS" )
|
||||
&& i->size() == 36
|
||||
&& ids.find( FsEncoding::encode( i->left( 32 ) ) ) == ids.end() )
|
||||
indexDir.remove( *i );
|
||||
{
|
||||
// must be folder .
|
||||
auto dirPath = Utils::Path::combine( Config::getIndexDir(), *i );
|
||||
QDir t( dirPath );
|
||||
t.removeRecursively();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Run deferred inits
|
||||
|
|
7
utils.cc
Normal file
7
utils.cc
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include "utils.hh"
|
||||
#include <QDir>
|
||||
|
||||
QString Utils::Path::combine(const QString& path1, const QString& path2)
|
||||
{
|
||||
return QDir::cleanPath(path1 + QDir::separator() + path2);
|
||||
}
|
Loading…
Reference in a new issue