Index: kdevplatform/shell/core.cpp =================================================================== --- kdevplatform/shell/core.cpp +++ kdevplatform/shell/core.cpp @@ -130,6 +130,26 @@ m_mode=mode; qCDebug(SHELL) << "Creating controllers"; +#if defined(Q_OS_UNIX) + auto tmpLocation = QStandardPaths::writableLocation(QStandardPaths::TempLocation); + const QString tmpName(QStringLiteral("/kdevelop-tmp-%1-").arg(getuid())); + const auto pos = tmpLocation.lastIndexOf(tmpName); + if (pos >= 0) { + // we must have been started by another KDevelop session, + // restore the default TempLocation + tmpLocation = tmpLocation.left(pos); + } + tmpLocation += tmpName + session; + m_tmpDir = new QDir(tmpLocation); + if (m_tmpDir->exists()) { + qCDebug(SHELL) << "Removing existing session temp dir" << tmpLocation; + m_tmpDir->removeRecursively(); + } + m_tmpDir->mkpath(tmpLocation); + if (m_tmpDir->exists()) { + qputenv("TMPDIR", tmpLocation.toLatin1()); + } +#endif if( !sessionController ) { @@ -313,6 +333,11 @@ delete testController.data(); delete runtimeController.data(); + if (m_tmpDir->exists()) { + m_tmpDir->removeRecursively(); + delete m_tmpDir; + } + selectionController.clear(); projectController.clear(); languageController.clear(); Index: kdevplatform/shell/core_p.h =================================================================== --- kdevplatform/shell/core_p.h +++ kdevplatform/shell/core_p.h @@ -26,6 +26,7 @@ #include #include +class QDir; namespace KDevelop { @@ -74,6 +75,7 @@ bool m_cleanedUp; bool m_shuttingDown; Core::Setup m_mode; + QDir* m_tmpDir = nullptr; }; }