mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +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 \
|
btreeidx.cc \
|
||||||
stardict.cc \
|
stardict.cc \
|
||||||
chunkedstorage.cc \
|
chunkedstorage.cc \
|
||||||
|
utils.cc \
|
||||||
weburlrequestinterceptor.cpp \
|
weburlrequestinterceptor.cpp \
|
||||||
xdxf2html.cc \
|
xdxf2html.cc \
|
||||||
iconv.cc \
|
iconv.cc \
|
||||||
|
|
|
@ -397,19 +397,24 @@ void loadDictionaries( QWidget * parent, bool showInitially,
|
||||||
|
|
||||||
QDir indexDir( Config::getIndexDir() );
|
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();
|
for( QStringList::const_iterator i = allIdxFiles.constBegin(); i != allIdxFiles.constEnd(); ++i )
|
||||||
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 );
|
indexDir.remove( *i );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
if ( i->endsWith( "_FTS" )
|
{
|
||||||
&& i->size() == 36
|
// must be folder .
|
||||||
&& ids.find( FsEncoding::encode( i->left( 32 ) ) ) == ids.end() )
|
auto dirPath = Utils::Path::combine( Config::getIndexDir(), *i );
|
||||||
indexDir.remove( *i );
|
QDir t( dirPath );
|
||||||
|
t.removeRecursively();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run deferred inits
|
// 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);
|
||||||
|
}
|
6
utils.hh
6
utils.hh
|
@ -274,6 +274,10 @@ inline bool isAudioUrl( QUrl const & url )
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Path{
|
||||||
|
QString combine(const QString& path1, const QString& path2);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
|
@ -313,4 +317,6 @@ inline QString getHostBaseFromUrl( QUrl const & url )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // UTILS_HH
|
#endif // UTILS_HH
|
||||||
|
|
Loading…
Reference in a new issue