split command line args for IndexerCommandCustom usages

* this seems to be required when using the new QProcess API.
* this also required to remove quotes that were added to path args because otherwise the Python indexer would mistake absolute paths for relative paths.
This commit is contained in:
mlangkabel
2021-01-25 20:36:42 +01:00
parent 093261232c
commit ecfa1b7920
17 changed files with 203 additions and 76 deletions
+13 -6
View File
@@ -56,16 +56,18 @@ std::shared_ptr<TestStorage> parseCode(std::string code)
const std::set<FilePathFilter> includeFilters;
const FilePath workingDirectory(L".");
std::wstring args = L"";
args += L" --source-file-path=%{SOURCE_FILE_PATH}";
args += L" --database-file-path=%{DATABASE_FILE_PATH}";
args += L" --shallow";
std::vector<std::wstring> args;
args.push_back(L"index");
args.push_back(L"--source-file-path=%{SOURCE_FILE_PATH}");
args.push_back(L"--database-file-path=%{DATABASE_FILE_PATH}");
args.push_back(L"--shallow");
std::shared_ptr<IndexerCommandCustom> indexerCommand = std::make_shared<IndexerCommandCustom>(
INDEXER_COMMAND_PYTHON,
L"\"" +
FilePath("../app").getConcatenated(ResourcePaths::getPythonPath()).makeAbsolute().wstr() +
L"SourcetrailPythonIndexer\" index" + args,
L"SourcetrailPythonIndexer\"",
args,
rootPath,
tempDbPath,
std::to_wstring(SqliteIndexStorage::getStorageVersion()),
@@ -74,7 +76,12 @@ std::shared_ptr<TestStorage> parseCode(std::string code)
std::wstring errorMessage;
const int result = utility::executeProcessAndGetExitCode(
indexerCommand->getCustomCommand(), {}, rootPath, -1, true, &errorMessage);
indexerCommand->getCommand(),
indexerCommand->getArguments(),
rootPath,
-1,
true,
&errorMessage);
REQUIRE(result == 0);
REQUIRE(errorMessage.empty());