aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/utils/consoleprocess.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/utils/consoleprocess.cpp')
-rw-r--r--src/libs/utils/consoleprocess.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/libs/utils/consoleprocess.cpp b/src/libs/utils/consoleprocess.cpp
index f4cde33a87..0edcd13163 100644
--- a/src/libs/utils/consoleprocess.cpp
+++ b/src/libs/utils/consoleprocess.cpp
@@ -34,11 +34,11 @@
#include <QAbstractEventDispatcher>
#include <QCoreApplication>
-#include <QCoreApplication>
#include <QDir>
#include <QFileInfo>
#include <QLocalServer>
#include <QLocalSocket>
+#include <QRegularExpression>
#include <QSettings>
#include <QTemporaryFile>
#include <QTimer>
@@ -136,6 +136,11 @@ void ConsoleProcess::setCommand(const CommandLine &command)
d->m_commandLine = command;
}
+CommandLine ConsoleProcess::command() const
+{
+ return d->m_commandLine;
+}
+
void ConsoleProcess::setSettings(QSettings *settings)
{
d->m_settings = settings;
@@ -278,8 +283,8 @@ static QString quoteWinArgument(const QString &arg)
QString ret(arg);
// Quotes are escaped and their preceding backslashes are doubled.
- ret.replace(QRegExp(QLatin1String("(\\\\*)\"")), QLatin1String("\\1\\1\\\""));
- if (ret.contains(QRegExp(QLatin1String("\\s")))) {
+ ret.replace(QRegularExpression("(\\\\*)\""), "\\1\\1\\\"");
+ if (ret.contains(QRegularExpression("\\s"))) {
// The argument must not end with a \ since this would be interpreted
// as escaping the quote -- rather put the \ behind the quote: e.g.
// rather use "foo"\ than "foo\"
@@ -296,7 +301,7 @@ static QString quoteWinArgument(const QString &arg)
QString createWinCommandline(const QString &program, const QStringList &args)
{
QString programName = quoteWinCommand(program);
- foreach (const QString &arg, args) {
+ for (const QString &arg : args) {
programName += QLatin1Char(' ');
programName += quoteWinArgument(arg);
}
@@ -419,13 +424,13 @@ bool ConsoleProcess::start()
const QStringList fixedEnvironment = [env] {
QStringList envStrings = env;
// add PATH if necessary (for DLL loading)
- if (envStrings.filter(QRegExp(QLatin1String("^PATH="),Qt::CaseInsensitive)).isEmpty()) {
+ if (envStrings.filter(QRegularExpression("^PATH=.*", QRegularExpression::CaseInsensitiveOption)).isEmpty()) {
QByteArray path = qgetenv("PATH");
if (!path.isEmpty())
envStrings.prepend(QString::fromLatin1("PATH=%1").arg(QString::fromLocal8Bit(path)));
}
// add systemroot if needed
- if (envStrings.filter(QRegExp(QLatin1String("^SystemRoot="),Qt::CaseInsensitive)).isEmpty()) {
+ if (envStrings.filter(QRegularExpression("^SystemRoot=.*", QRegularExpression::CaseInsensitiveOption)).isEmpty()) {
QByteArray systemRoot = qgetenv("SystemRoot");
if (!systemRoot.isEmpty())
envStrings.prepend(QString::fromLatin1("SystemRoot=%1").arg(QString::fromLocal8Bit(systemRoot)));