aboutsummaryrefslogtreecommitdiffstats
path: root/src/app
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2017-01-19 16:44:22 +0100
committerTim Jenssen <tim.jenssen@qt.io>2017-01-20 12:17:10 +0000
commitc6f90e575e2e261f7fa50f951b6fc1824ae5c12f (patch)
tree7f3564ad1491a5f40e64bcee89d70b884409885f /src/app
parente6017c40fca059b27e449f0605f4d79b78de0ff3 (diff)
Utils: Introduce a TemporaryDirectory and TemporaryFile class
Both wrap the corresponding Qt class, but make sure all temporary files or directories are created inside a "master temporary directory". Change-Id: I55461be507c828c965224c02863ea5ed9bbf9498 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Diffstat (limited to 'src/app')
-rw-r--r--src/app/main.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/app/main.cpp b/src/app/main.cpp
index ba1af663dae..97a509757b2 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -31,8 +31,10 @@
#include <extensionsystem/pluginmanager.h>
#include <extensionsystem/pluginspec.h>
#include <qtsingleapplication.h>
+
#include <utils/fileutils.h>
#include <utils/hostosinfo.h>
+#include <utils/temporarydirectory.h>
#include <QDebug>
#include <QDir>
@@ -278,6 +280,8 @@ void loadFonts()
int main(int argc, char **argv)
{
+ Utils::TemporaryDirectory::setMasterTemporaryDirectory(QDir::tempPath() + "/QtCreator-XXXXXX");
+
const char *highDpiEnvironmentVariable = setHighDpiEnvironmentVariable();
QLoggingCategory::setFilterRules(QLatin1String("qtc.*.debug=false\nqtc.*.info=false"));
@@ -345,11 +349,9 @@ int main(int argc, char **argv)
testOptionProvided = true;
}
}
- QScopedPointer<QTemporaryDir> temporaryCleanSettingsDir;
+ QScopedPointer<Utils::TemporaryDirectory> temporaryCleanSettingsDir;
if (settingsPath.isEmpty() && testOptionProvided) {
- const QString settingsPathTemplate = QDir::cleanPath(QDir::tempPath()
- + QString::fromLatin1("/qtc-test-settings-XXXXXX"));
- temporaryCleanSettingsDir.reset(new QTemporaryDir(settingsPathTemplate));
+ temporaryCleanSettingsDir.reset(new Utils::TemporaryDirectory("qtc-test-settings"));
if (!temporaryCleanSettingsDir->isValid())
return 1;
settingsPath = temporaryCleanSettingsDir->path();