mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 20:40:29 +08:00
Use temp dir. for cache when a unit test is performed
* the temp. dir can also be used for other purposes
This commit is contained in:
committed by
Roland Winklmeier
parent
09d74c48b8
commit
44258a97fa
@@ -98,7 +98,12 @@ namespace BlackCore
|
|||||||
QCoreApplication::setApplicationVersion(CVersion::version());
|
QCoreApplication::setApplicationVersion(CVersion::version());
|
||||||
this->setObjectName(this->m_applicationName);
|
this->setObjectName(this->m_applicationName);
|
||||||
const QString executable = QFileInfo(QCoreApplication::applicationFilePath()).fileName();
|
const QString executable = QFileInfo(QCoreApplication::applicationFilePath()).fileName();
|
||||||
if (executable.startsWith("test")) { this->m_unitTest = true; }
|
if (executable.startsWith("test"))
|
||||||
|
{
|
||||||
|
this->m_unitTest = true;
|
||||||
|
const QString tempPath(this->getTemporaryDirectory());
|
||||||
|
BlackMisc::setMockCacheRootDirectory(tempPath);
|
||||||
|
}
|
||||||
this->initParser();
|
this->initParser();
|
||||||
this->initLogging();
|
this->initLogging();
|
||||||
|
|
||||||
@@ -385,6 +390,18 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString CApplication::getTemporaryDirectory() const
|
||||||
|
{
|
||||||
|
if (this->m_tempDirectory.isValid())
|
||||||
|
{
|
||||||
|
return this->m_tempDirectory.path();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return QDir::tempPath();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString CApplication::getInfoString(const QString &separator) const
|
QString CApplication::getInfoString(const QString &separator) const
|
||||||
{
|
{
|
||||||
QString str(CVersion::version());
|
QString str(CVersion::version());
|
||||||
@@ -424,8 +441,7 @@ namespace BlackCore
|
|||||||
Q_ASSERT(reply);
|
Q_ASSERT(reply);
|
||||||
multiPart->setParent(reply);
|
multiPart->setParent(reply);
|
||||||
return reply;
|
return reply;
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QNetworkReply *CApplication::headerFromNetwork(const CUrl &url, const BlackMisc::CSlot<void (QNetworkReply *)> &callback)
|
QNetworkReply *CApplication::headerFromNetwork(const CUrl &url, const BlackMisc::CSlot<void (QNetworkReply *)> &callback)
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
#include <QTemporaryDir>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
@@ -188,6 +189,9 @@ namespace BlackCore
|
|||||||
//! Save all settings
|
//! Save all settings
|
||||||
BlackMisc::CStatusMessage saveSettingsByKey(const QStringList &keys);
|
BlackMisc::CStatusMessage saveSettingsByKey(const QStringList &keys);
|
||||||
|
|
||||||
|
//! Directory for temporary files
|
||||||
|
QString getTemporaryDirectory() const;
|
||||||
|
|
||||||
//! Run event loop
|
//! Run event loop
|
||||||
static int exec();
|
static int exec();
|
||||||
|
|
||||||
@@ -434,6 +438,7 @@ namespace BlackCore
|
|||||||
QScopedPointer<CSetupReader> m_setupReader; //!< setup reader
|
QScopedPointer<CSetupReader> m_setupReader; //!< setup reader
|
||||||
QScopedPointer<CWebDataServices> m_webDataServices; //!< web data services
|
QScopedPointer<CWebDataServices> m_webDataServices; //!< web data services
|
||||||
QScopedPointer<BlackMisc::CFileLogger> m_fileLogger; //!< file logger
|
QScopedPointer<BlackMisc::CFileLogger> m_fileLogger; //!< file logger
|
||||||
|
QTemporaryDir m_tempDirectory; //!< temp.directory for the lifetime of application object
|
||||||
QNetworkAccessManager m_accessManager { this }; //!< single network access manager
|
QNetworkAccessManager m_accessManager { this }; //!< single network access manager
|
||||||
CCookieManager m_cookieManager; //!< single cookie manager for our access manager
|
CCookieManager m_cookieManager; //!< single cookie manager for our access manager
|
||||||
QString m_applicationName; //!< application name
|
QString m_applicationName; //!< application name
|
||||||
|
|||||||
Reference in New Issue
Block a user