iOS: Reverting Utils::TemporaryFile changes

Temporary files are created to redirect the console output of the
running app and the files must be created in the simulator's file
system

Change-Id: Ib0f1d8366ca1606b2988b028b0aac944e0fe3432
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Vikas Pachdha
2017-01-23 13:52:52 +01:00
parent 03fc3c270d
commit 7beb5d5c24

View File

@@ -35,7 +35,6 @@
#include <utils/fileutils.h>
#include "utils/runextensions.h"
#include "utils/synchronousprocess.h"
#include "utils/temporaryfile.h"
#include <QCoreApplication>
#include <QDir>
@@ -51,6 +50,7 @@
#include <QProcessEnvironment>
#include <QScopedArrayPointer>
#include <QSocketNotifier>
#include <QTemporaryFile>
#include <QTimer>
#include <QXmlStreamReader>
@@ -81,8 +81,8 @@ class LogTailFiles : public QObject
Q_OBJECT
public:
void exec(QFutureInterface<void> &fi, std::shared_ptr<Utils::TemporaryFile> stdoutFile,
std::shared_ptr<Utils::TemporaryFile> stderrFile)
void exec(QFutureInterface<void> &fi, std::shared_ptr<QTemporaryFile> stdoutFile,
std::shared_ptr<QTemporaryFile> stderrFile)
{
if (fi.isCanceled())
return;
@@ -96,7 +96,7 @@ public:
watcher.setFuture(fi.future());
// Process to print the console output while app is running.
auto logProcess = [this, fi](QProcess *tailProcess, std::shared_ptr<Utils::TemporaryFile> file) {
auto logProcess = [this, fi](QProcess *tailProcess, std::shared_ptr<QTemporaryFile> file) {
QObject::connect(tailProcess, &QProcess::readyReadStandardOutput, [=]() {
if (!fi.isCanceled())
emit logMessage(QString::fromLocal8Bit(tailProcess->readAll()));
@@ -910,13 +910,13 @@ void IosSimulatorToolHandlerPrivate::launchAppOnSimulator(const QStringList &ext
const QString bundleId = SimulatorControl::bundleIdentifier(appBundle);
const bool debugRun = runKind == IosToolHandler::DebugRun;
bool captureConsole = IosConfigurations::xcodeVersion() >= QVersionNumber(8);
std::shared_ptr<Utils::TemporaryFile> stdoutFile;
std::shared_ptr<Utils::TemporaryFile> stderrFile;
std::shared_ptr<QTemporaryFile> stdoutFile;
std::shared_ptr<QTemporaryFile> stderrFile;
if (captureConsole) {
const QString fileTemplate = CONSOLE_PATH_TEMPLATE.arg(deviceId).arg(bundleId);
stdoutFile.reset(new Utils::TemporaryFile(fileTemplate + ".stdout"));
stderrFile.reset(new Utils::TemporaryFile(fileTemplate + ".stderr"));
stdoutFile.reset(new QTemporaryFile(fileTemplate + ".stdout"));
stderrFile.reset(new QTemporaryFile(fileTemplate + ".stderr"));
captureConsole = stdoutFile->open() && stderrFile->open();
if (!captureConsole)