Utils: Add CommandLine convenience constructors

... taking a QString for the executable.

This weakens the very explicit QString -> FileName conversion via the
named constructors for the special case of constructing a CommandLine.

I think that's worthwhile here, as it reduces the noise on the caller
site under circumstance where the nature of the thing is obvious.

Change-Id: I27b4a73639728893d053b2e7ba65cb745f0ffe83
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-07-23 10:17:57 +02:00
parent 80716610c5
commit 8b72e92167
31 changed files with 55 additions and 53 deletions

View File

@@ -140,8 +140,7 @@ namespace {
SynchronousProcess proc;
proc.setProcessChannelMode(QProcess::MergedChannels);
proc.setTimeoutS(30);
SynchronousProcessResponse response
= proc.runBlocking({FilePath::fromString(executable), {shell}});
SynchronousProcessResponse response = proc.runBlocking({executable, {shell}});
if (response.result != SynchronousProcessResponse::Finished)
return true;
return !response.allOutput().contains("x86-64");
@@ -1189,7 +1188,7 @@ void AndroidConfigurations::load()
proc.setTimeoutS(2);
proc.setProcessChannelMode(QProcess::MergedChannels);
SynchronousProcessResponse response =
proc.runBlocking({FilePath::fromString(javaHomeExec.absoluteFilePath()), {}});
proc.runBlocking({javaHomeExec.absoluteFilePath(), {}});
if (response.result == SynchronousProcessResponse::Finished) {
const QString &javaHome = response.allOutput().trimmed();
if (!javaHome.isEmpty() && QFileInfo::exists(javaHome))