diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2017-10-12 14:17:43 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2017-10-13 08:18:12 +0000 |
commit | 07fa68a352864f70b7930c996c4b4a7c5d9cd4a7 (patch) | |
tree | 8867b28c80be75bd9296c66e74ea4ec545500846 | |
parent | 34824b34677633ba5b8959525169ce313490a30b (diff) |
Remove superfluous use of QScopedPointer in RunEnvironment
The QTemporaryFile object can be created on the stack.
Change-Id: Ief886edfff21681b2b2f6ffb425664b511d3c611
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r-- | src/lib/corelib/api/runenvironment.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/lib/corelib/api/runenvironment.cpp b/src/lib/corelib/api/runenvironment.cpp index 0bc3c4b98..0470bfb9a 100644 --- a/src/lib/corelib/api/runenvironment.cpp +++ b/src/lib/corelib/api/runenvironment.cpp @@ -56,7 +56,6 @@ #include <QtCore/qdir.h> #include <QtCore/qprocess.h> #include <QtCore/qprocess.h> -#include <QtCore/qscopedpointer.h> #include <QtCore/qtemporaryfile.h> #include <QtCore/qvariant.h> @@ -170,7 +169,6 @@ int RunEnvironment::doRunShell() for (const QString &key : environment.keys()) qputenv(key.toLocal8Bit().constData(), environment.value(key).toLocal8Bit()); QString command; - QScopedPointer<QTemporaryFile> envFile; if (HostOsInfo::isWindowsHost()) { command = environment.value(QLatin1String("COMSPEC")); if (command.isEmpty()) @@ -191,14 +189,14 @@ int RunEnvironment::doRunShell() const QString prompt = QLatin1String("qbs ") + configName + (!productId.isEmpty() ? QLatin1Char(' ') + productId : QString()) + QLatin1String(" $ "); - envFile.reset(new QTemporaryFile); - if (envFile->open()) { + QTemporaryFile envFile; + if (envFile.open()) { if (command.endsWith(QLatin1String("bash"))) command += QLatin1String(" --posix"); // Teach bash some manners. const QString promptLine = QLatin1String("PS1='") + prompt + QLatin1String("'\n"); - envFile->write(promptLine.toLocal8Bit()); - envFile->close(); - qputenv("ENV", envFile->fileName().toLocal8Bit()); + envFile.write(promptLine.toLocal8Bit()); + envFile.close(); + qputenv("ENV", envFile.fileName().toLocal8Bit()); } else { d->logger.qbsWarning() << Tr::tr("Setting custom shell prompt failed."); } |