Fix topdirs existence checking for non default config dirs
This commit is contained in:
parent
f6b7df9292
commit
4d911028d8
3 changed files with 38 additions and 22 deletions
|
@ -477,7 +477,7 @@ int main(int argc, char **argv)
|
||||||
Usage();
|
Usage();
|
||||||
if ((op_flags & OPT_Z) && (op_flags & (OPT_m)))
|
if ((op_flags & OPT_Z) && (op_flags & (OPT_m)))
|
||||||
Usage();
|
Usage();
|
||||||
if ((op_flags & OPT_E) && (op_flags & ~OPT_E)) {
|
if ((op_flags & OPT_E) && (op_flags & ~(OPT_E|OPT_c))) {
|
||||||
Usage();
|
Usage();
|
||||||
}
|
}
|
||||||
string reason;
|
string reason;
|
||||||
|
|
|
@ -177,6 +177,30 @@ void RclMain::periodic100()
|
||||||
fileExit();
|
fileExit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RclMain::checkIdxPaths()
|
||||||
|
{
|
||||||
|
vector<string> args;
|
||||||
|
|
||||||
|
string badpaths;
|
||||||
|
args.push_back("recollindex");
|
||||||
|
args.push_back("-E");
|
||||||
|
args.push_back("-c");
|
||||||
|
args.push_back(theconfig->getConfDir());
|
||||||
|
ExecCmd::backtick(args, badpaths);
|
||||||
|
if (!badpaths.empty()) {
|
||||||
|
int rep =
|
||||||
|
QMessageBox::warning(0, tr("Bad paths"),
|
||||||
|
tr("Bad paths in configuration file:\n") +
|
||||||
|
QString::fromLocal8Bit(badpaths.c_str()),
|
||||||
|
QMessageBox::Ok,
|
||||||
|
QMessageBox::Cancel,
|
||||||
|
QMessageBox::NoButton);
|
||||||
|
if (rep == QMessageBox::Cancel)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// This gets called when the "update index" action is activated. It executes
|
// This gets called when the "update index" action is activated. It executes
|
||||||
// the requested action, and disables the menu entry. This will be
|
// the requested action, and disables the menu entry. This will be
|
||||||
// re-enabled by the indexing status check
|
// re-enabled by the indexing status check
|
||||||
|
@ -228,25 +252,10 @@ void RclMain::toggleIndexing()
|
||||||
string mhd;
|
string mhd;
|
||||||
m_firstIndexing = !theconfig->getMissingHelperDesc(mhd);
|
m_firstIndexing = !theconfig->getMissingHelperDesc(mhd);
|
||||||
|
|
||||||
vector<string> args;
|
if (!checkIdxPaths()) {
|
||||||
|
return;
|
||||||
string badpaths;
|
|
||||||
args.push_back("recollindex");
|
|
||||||
args.push_back("-E");
|
|
||||||
ExecCmd::backtick(args, badpaths);
|
|
||||||
if (!badpaths.empty()) {
|
|
||||||
int rep =
|
|
||||||
QMessageBox::warning(0, tr("Bad paths"),
|
|
||||||
tr("Bad paths in configuration file:\n") +
|
|
||||||
QString::fromLocal8Bit(badpaths.c_str()),
|
|
||||||
QMessageBox::Ok,
|
|
||||||
QMessageBox::Cancel,
|
|
||||||
QMessageBox::NoButton);
|
|
||||||
if (rep == QMessageBox::Cancel)
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
vector<string> args;
|
||||||
args.clear();
|
|
||||||
args.push_back("-c");
|
args.push_back("-c");
|
||||||
args.push_back(theconfig->getConfDir());
|
args.push_back(theconfig->getConfDir());
|
||||||
m_idxproc = new ExecCmd;
|
m_idxproc = new ExecCmd;
|
||||||
|
@ -280,9 +289,10 @@ void RclMain::rebuildIndex()
|
||||||
QMessageBox::NoButton);
|
QMessageBox::NoButton);
|
||||||
if (rep == QMessageBox::Ok) {
|
if (rep == QMessageBox::Ok) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// Under windows, it's necessary to close the db here, else Xapian
|
// Under windows, it's necessary to close the db here,
|
||||||
// won't be able to do what it wants with the (open) files. Of course
|
// else Xapian won't be able to do what it wants with the
|
||||||
// if there are several GUI instances, this won't work...
|
// (open) files. Of course if there are several GUI
|
||||||
|
// instances, this won't work...
|
||||||
if (rcldb)
|
if (rcldb)
|
||||||
rcldb->close();
|
rcldb->close();
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
@ -291,6 +301,11 @@ void RclMain::rebuildIndex()
|
||||||
// firstIndexing is used for)
|
// firstIndexing is used for)
|
||||||
string mhd;
|
string mhd;
|
||||||
m_firstIndexing = !theconfig->getMissingHelperDesc(mhd);
|
m_firstIndexing = !theconfig->getMissingHelperDesc(mhd);
|
||||||
|
|
||||||
|
if (!checkIdxPaths()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
vector<string> args;
|
vector<string> args;
|
||||||
args.push_back("-c");
|
args.push_back("-c");
|
||||||
args.push_back(theconfig->getConfDir());
|
args.push_back(theconfig->getConfDir());
|
||||||
|
|
|
@ -265,6 +265,7 @@ private:
|
||||||
virtual void initiateQuery();
|
virtual void initiateQuery();
|
||||||
virtual bool containerUpToDate(Rcl::Doc& doc);
|
virtual bool containerUpToDate(Rcl::Doc& doc);
|
||||||
virtual void setFiltSpec();
|
virtual void setFiltSpec();
|
||||||
|
virtual bool checkIdxPaths();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // RCLMAIN_W_H
|
#endif // RCLMAIN_W_H
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue