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

@@ -233,7 +233,7 @@ static QByteArray decodeProvisioningProfile(const QString &path)
p.setTimeoutS(3);
// path is assumed to be valid file path to .mobileprovision
const QStringList args = {"smime", "-inform", "der", "-verify", "-in", path};
Utils::SynchronousProcessResponse res = p.runBlocking({FilePath::fromString("openssl"), args});
Utils::SynchronousProcessResponse res = p.runBlocking({"openssl", args});
if (res.result != Utils::SynchronousProcessResponse::Finished)
qCDebug(iosCommonLog) << "Reading signed provisioning file failed" << path;
return res.stdOut().toLatin1();

View File

@@ -67,7 +67,7 @@ void XcodeProbe::detectDeveloperPaths()
{
Utils::SynchronousProcess selectedXcode;
selectedXcode.setTimeoutS(5);
const CommandLine xcodeSelect{FilePath::fromString("/usr/bin/xcode-select"), {"--print-path"}};
const CommandLine xcodeSelect{"/usr/bin/xcode-select", {"--print-path"}};
Utils::SynchronousProcessResponse response = selectedXcode.run(xcodeSelect);
if (response.result != Utils::SynchronousProcessResponse::Finished)
qCWarning(probeLog)

View File

@@ -91,7 +91,7 @@ static bool runCommand(const CommandLine &command, QString *output)
static bool runSimCtlCommand(QStringList args, QString *output)
{
args.prepend("simctl");
return runCommand({FilePath::fromString("xcrun"), args}, output);
return runCommand({"xcrun", args}, output);
}
static bool launchSimulator(const QString &simUdid) {
@@ -102,7 +102,7 @@ static bool launchSimulator(const QString &simUdid) {
if (IosConfigurations::xcodeVersion() >= QVersionNumber(9)) {
// For XCode 9 boot the second device instead of launching simulator app twice.
QString psOutput;
if (runCommand({FilePath::fromString("ps"), {"-A", "-o", "comm"}}, &psOutput)) {
if (runCommand({"ps", {"-A", "-o", "comm"}}, &psOutput)) {
for (const QString &comm : psOutput.split('\n')) {
if (comm == simulatorAppPath)
return runSimCtlCommand({"boot", simUdid}, nullptr);