[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdesupport/strigi/src/daemon
From: Sebastian Trueg <sebastian () trueg ! de>
Date: 2007-10-03 10:36:46
Message-ID: 1191407806.556335.22407.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 720612 by trueg:
* Added command line parameter to list the available backends.
* Added check if the configured backend exists. If not, strigidaemon will exit with \
an error message.
M +23 -0 daemon.cpp
--- trunk/kdesupport/strigi/src/daemon/daemon.cpp #720611:720612
@@ -146,8 +146,16 @@
printf( " --help Display this help text.\n" );
printf( " -t <backend> Override the index backend.\n" );
printf( " -d <indexdir> Override the index dir.\n" );
+ printf( " --backends List the available backends.\n" );
}
void
+printBackendList() {
+ std::vector<std::string> backends = CombinedIndexManager::backEnds();
+ for ( unsigned int i = 0; i < backends.size(); ++i ) {
+ printf( "%s\n", backends[i].c_str() );
+ }
+}
+void
checkArgs(int argc, char** argv) {
int i = 1;
while ( i < argc ) {
@@ -159,6 +167,10 @@
printUsage(argc, argv);
exit( 0 );
}
+ else if ( !strcmp( argv[i], "--backends" ) ) {
+ printBackendList();
+ exit( 0 );
+ }
else if ( !strcmp( argv[i], "-t" ) ) {
++i;
if ( i >= argc ) {
@@ -179,6 +191,14 @@
++i;
}
}
+void
+ensureBackend( const std::string& backendName ) {
+ std::vector<std::string> backends = CombinedIndexManager::backEnds();
+ if ( std::find( backends.begin(), backends.end(), backendName ) == \
backends.end() ) { + fprintf( stderr, "Unknown backend type: %s\n", \
backendName.c_str() ); + exit( 2 );
+ }
+}
int
main(int argc, char** argv) {
// set up the directory paths
@@ -242,6 +262,9 @@
set<string> dirs = config.getIndexedDirectories();
+ // before creating the indexer, check if the index backend exists
+ ensureBackend( !userForcedIndexType.empty() ? userForcedIndexType : \
config.getWriteableIndexType() ); +
CombinedIndexManager* index = new CombinedIndexManager(
!userForcedIndexType.empty() ? userForcedIndexType : \
config.getWriteableIndexType(),
!userForcedIndexDir.empty() ? userForcedIndexDir : \
config.getWriteableIndexDir());
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic