mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14: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 \
|
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 ( ids.find( FsEncoding::encode( *i ) ) == ids.end()
|
if( i->size() >= 32 && ids.find( FsEncoding::encode( i->left( 32 ) ) ) == ids.end() )
|
||||||
&& i->size() == 32 )
|
{
|
||||||
indexDir.remove( *i );
|
if( QFile::exists( *i ) )
|
||||||
else
|
{
|
||||||
if ( i->endsWith( "_FTS" )
|
indexDir.remove( *i );
|
||||||
&& i->size() == 36
|
}
|
||||||
&& ids.find( FsEncoding::encode( i->left( 32 ) ) ) == ids.end() )
|
else
|
||||||
indexDir.remove( *i );
|
{
|
||||||
|
// must be folder .
|
||||||
|
auto dirPath = Utils::Path::combine( Config::getIndexDir(), *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