diff --git a/src/plugins/cppcheck/cppcheckrunner.cpp b/src/plugins/cppcheck/cppcheckrunner.cpp index 4f9b23646c5..d3f034e80b1 100644 --- a/src/plugins/cppcheck/cppcheckrunner.cpp +++ b/src/plugins/cppcheck/cppcheckrunner.cpp @@ -113,16 +113,17 @@ void CppcheckRunner::checkQueued() if (m_queue.isEmpty() || !m_binary.isExecutableFile()) return; + CommandLine commandLine{m_binary, m_arguments, CommandLine::Raw}; FilePaths files = m_queue.begin().value(); - QString arguments = m_arguments + ' ' + m_queue.begin().key(); + commandLine.addArg(m_queue.begin().key()); m_currentFiles.clear(); - int argumentsLength = arguments.length(); + int argumentsLength = commandLine.arguments().length(); while (!files.isEmpty()) { - argumentsLength += files.first().toString().size() + 1; // +1 for separator + argumentsLength += files.first().toString().size() + 3; // +1 for separator +2 for quotes if (argumentsLength >= m_maxArgumentsLength) break; m_currentFiles.push_back(files.first()); - arguments += ' ' + files.first().toString(); + commandLine.addArg(files.first().toString()); files.pop_front(); } @@ -131,7 +132,7 @@ void CppcheckRunner::checkQueued() else m_queue.begin().value() = files; - m_process.setCommand({m_binary, arguments, CommandLine::Raw}); + m_process.setCommand(commandLine); m_process.start(); }