recollindex -r: make path args absolute using the original working directory, not the rundir (tmp)

This commit is contained in:
Jean-Francois Dockes
2020-07-13 10:47:32 +02:00
parent 476a3ba743
commit 5915dd6cea
3 changed files with 31 additions and 12 deletions
+6
View File
@@ -585,6 +585,10 @@ static vector<string> fileToArgs(const string& fn)
}
// Working directory before we change: it's simpler to change early
// but some options need the original for computing absolute paths.
static std::string orig_cwd;
// A bit of history: it's difficult to pass non-ASCII parameters
// (e.g. path names) on the command line under Windows without using
// Unicode. It was first thought possible to use a temporary file to
@@ -725,6 +729,7 @@ int main(int argc, char *argv[])
exit(0);
}
orig_cwd = path_cwd();
string rundir;
config->getConfParam("idxrundir", rundir);
if (!rundir.empty()) {
@@ -775,6 +780,7 @@ int main(int argc, char *argv[])
if (aremain != 1)
Usage();
string top = args[argidx++]; aremain--;
top = path_canon(top, &orig_cwd);
bool status = recursive_index(config, top, selpatterns);
if (confindexer && !confindexer->getReason().empty()) {
addIdxReason("indexer", confindexer->getReason());