centralize skippedNames computation to add dbdir always
This commit is contained in:
parent
c78a055bb2
commit
d8f8dd851e
@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.31 2006-10-16 15:33:08 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.32 2006-10-24 09:09:36 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
#endif
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -313,6 +313,26 @@ string RclConfig::getDbDir()
|
||||
return dbdir;
|
||||
}
|
||||
|
||||
list<string> RclConfig::getSkippedNames()
|
||||
{
|
||||
list<string> skpl;
|
||||
string skipped;
|
||||
if (getConfParam("skippedNames", skipped)) {
|
||||
stringToStrings(skipped, skpl);
|
||||
}
|
||||
// If current keydir is dbdir's ancestor, add dbdir name to skipped
|
||||
// This is mainly for the real-time monitor that will otherwise go
|
||||
// into a loop
|
||||
// We'd prefer to do it for the direct ancestor only, but getSkippedNames()
|
||||
// is only called for the topdirs, so this doesn't work
|
||||
string kd = path_canon(getKeyDir());
|
||||
string dbd = path_canon(getDbDir());
|
||||
if (dbd.find(kd) == 0) {
|
||||
skpl.push_back(path_getsimple(dbd));
|
||||
}
|
||||
return skpl;
|
||||
}
|
||||
|
||||
|
||||
// Look up an executable filter. We look in $RECOLL_FILTERSDIR,
|
||||
// filtersdir in config file, then let the system use the PATH
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
*/
|
||||
#ifndef _RCLCONFIG_H_INCLUDED_
|
||||
#define _RCLCONFIG_H_INCLUDED_
|
||||
/* @(#$Id: rclconfig.h,v 1.23 2006-10-16 15:33:08 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||
/* @(#$Id: rclconfig.h,v 1.24 2006-10-24 09:09:36 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
@ -74,6 +74,9 @@ class RclConfig {
|
||||
/** Get database directory */
|
||||
string getDbDir();
|
||||
|
||||
/** Get list of skipped names for current keydir */
|
||||
list<string> getSkippedNames();
|
||||
|
||||
/**
|
||||
* Get list of ignored suffixes from mimemap
|
||||
*
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: indexer.cpp,v 1.39 2006-10-22 14:47:13 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: indexer.cpp,v 1.40 2006-10-24 09:09:36 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
#endif
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -96,13 +96,7 @@ bool DbIndexer::indexDb(bool resetbefore, list<string> *topdirs)
|
||||
|
||||
// Set up skipped patterns for this subtree. This probably should be
|
||||
// done in the directory change code in processone() instead.
|
||||
m_walker.clearSkippedNames();
|
||||
string skipped;
|
||||
if (m_config->getConfParam("skippedNames", skipped)) {
|
||||
list<string> skpl;
|
||||
stringToStrings(skipped, skpl);
|
||||
m_walker.setSkippedNames(skpl);
|
||||
}
|
||||
m_walker.setSkippedNames(m_config->getSkippedNames());
|
||||
|
||||
// Walk the directory tree
|
||||
if (m_walker.walk(*it, *this) != FsTreeWalker::FtwOk) {
|
||||
@ -238,11 +232,8 @@ bool DbIndexer::indexFiles(const list<string> &filenames)
|
||||
static list<string> skpl;
|
||||
if (lstdir.compare(dir)) {
|
||||
LOGDEB(("Recomputing list of skipped names\n"));
|
||||
string skipped;
|
||||
if (m_config->getConfParam("skippedNames", skipped)) {
|
||||
stringToStrings(skipped, skpl);
|
||||
lstdir = dir;
|
||||
}
|
||||
skpl = m_config->getSkippedNames();
|
||||
lstdir = dir;
|
||||
}
|
||||
if (!skpl.empty()) {
|
||||
list<string>::const_iterator skit;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#include "autoconfig.h"
|
||||
#ifdef RCL_MONITOR
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: rclmonrcv.cpp,v 1.5 2006-10-23 15:01:12 dockes Exp $ (C) 2006 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: rclmonrcv.cpp,v 1.6 2006-10-24 09:09:36 dockes Exp $ (C) 2006 J.F.Dockes";
|
||||
#endif
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -129,13 +129,7 @@ void *rclMonRcvRun(void *q)
|
||||
for (list<string>::iterator it = tdl.begin(); it != tdl.end(); it++) {
|
||||
queue->getConfig()->setKeyDir(*it);
|
||||
// Adjust the skipped names according to config
|
||||
walker.clearSkippedNames();
|
||||
string skipped;
|
||||
if (queue->getConfig()->getConfParam("skippedNames", skipped)) {
|
||||
list<string> skpl;
|
||||
stringToStrings(skipped, skpl);
|
||||
walker.setSkippedNames(skpl);
|
||||
}
|
||||
walker.setSkippedNames(queue->getConfig()->getSkippedNames());
|
||||
LOGDEB(("rclMonRcvRun: walking %s\n", it->c_str()));
|
||||
walker.walk(*it, walkcb);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user