Skip to content
Snippets Groups Projects
Commit 1eeefa1b authored by con's avatar con
Browse files

Split argument list correctly. Makes "Edit in vi" work on Linux.

It now follows quoting rules.
parent 2a4bfc8d
No related branches found
No related tags found
No related merge requests found
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<category xml:lang="de">Text</category> <category xml:lang="de">Text</category>
<executable output="reloaddocument"> <executable output="reloaddocument">
<path>xterm</path> <path>xterm</path>
<arguments>-geom %{CurrentDocument:Width}x%{CurrentDocument:Height}+%{CurrentDocument:XPos}+%{CurrentDocument:YPos} -e vi \"%{CurrentDocument:FilePath}\" +%{CurrentDocument:Row} +"normal %{CurrentDocument:Column}|"</arguments> <arguments>-geom %{CurrentDocument:ColumnCount}x%{CurrentDocument:RowCount}+%{CurrentDocument:XPos}+%{CurrentDocument:YPos} -e vi "%{CurrentDocument:FilePath}" +%{CurrentDocument:Row} +"normal %{CurrentDocument:Column}|"</arguments>
<workingdirectory>%{CurrentDocument:Path}</workingdirectory> <workingdirectory>%{CurrentDocument:Path}</workingdirectory>
</executable> </executable>
</externaltool> </externaltool>
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/stringutils.h> #include <utils/stringutils.h>
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/qtcprocess.h>
#include <QtCore/QXmlStreamReader> #include <QtCore/QXmlStreamReader>
#include <QtCore/QDir> #include <QtCore/QDir>
...@@ -314,8 +315,13 @@ bool ExternalToolRunner::resolve() ...@@ -314,8 +315,13 @@ bool ExternalToolRunner::resolve()
{ // arguments { // arguments
QString resolved = Utils::expandMacros(m_tool->arguments(), QString resolved = Utils::expandMacros(m_tool->arguments(),
Core::VariableManager::instance()->macroExpander()); Core::VariableManager::instance()->macroExpander());
// TODO stupid, do it right // handle quoting in the command line arguments etc
m_resolvedArguments = resolved.split(QLatin1Char(' '), QString::SkipEmptyParts); QString cmd;
Utils::QtcProcess::prepareCommand(m_resolvedExecutable, resolved,
&cmd, &m_resolvedArguments);
if (cmd.isEmpty())
return false;
m_resolvedExecutable = cmd;
} }
{ // input { // input
m_resolvedInput = Utils::expandMacros(m_tool->input(), m_resolvedInput = Utils::expandMacros(m_tool->input(),
...@@ -357,6 +363,8 @@ void ExternalToolRunner::run() ...@@ -357,6 +363,8 @@ void ExternalToolRunner::run()
m_process->setWorkingDirectory(m_resolvedWorkingDirectory); m_process->setWorkingDirectory(m_resolvedWorkingDirectory);
ICore::instance()->messageManager()->printToOutputPane( ICore::instance()->messageManager()->printToOutputPane(
tr("Starting external tool '%1'").arg(m_resolvedExecutable), false); tr("Starting external tool '%1'").arg(m_resolvedExecutable), false);
ICore::instance()->messageManager()->printToOutputPane(
tr("with arguments (%1)").arg(m_resolvedArguments.join(QLatin1String(", "))), false);
m_process->start(m_resolvedExecutable, m_resolvedArguments, QIODevice::ReadWrite); m_process->start(m_resolvedExecutable, m_resolvedArguments, QIODevice::ReadWrite);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment