mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-15 01:05:35 +08:00
Write settings, logs, cache, etc. into a installation dependent subfolder
refs #668
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include "blackcore/webdataservices.h"
|
||||
#include "blackmisc/datacache.h"
|
||||
#include "blackmisc/dbusserver.h"
|
||||
#include "blackmisc/directoryutils.h"
|
||||
#include "blackmisc/filelogger.h"
|
||||
#include "blackmisc/logcategory.h"
|
||||
#include "blackmisc/logcategorylist.h"
|
||||
@@ -456,14 +457,6 @@ namespace BlackCore
|
||||
}
|
||||
}
|
||||
|
||||
QString CApplication::applicationDirPath()
|
||||
{
|
||||
QString appDirectoryString(qApp->applicationDirPath());
|
||||
if (appDirectoryString.endsWith("Contents/MacOS")) { appDirectoryString += "/../../.."; }
|
||||
QDir appDirectory(appDirectoryString);
|
||||
return appDirectory.absolutePath();
|
||||
}
|
||||
|
||||
bool CApplication::useContexts(const CCoreFacadeConfig &coreConfig)
|
||||
{
|
||||
Q_ASSERT_X(this->m_parsed, Q_FUNC_INFO, "Call this function after parsing");
|
||||
@@ -535,7 +528,10 @@ namespace BlackCore
|
||||
CLogHandler::instance()->install(); // make sure we have a log handler!
|
||||
|
||||
// File logger
|
||||
static const QString logPath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/org.swift-project/logs";
|
||||
static const QString logPath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +
|
||||
"/org.swift-project/" +
|
||||
CDirectoryUtils::normalizedApplicationDirectory() +
|
||||
"/logs";
|
||||
this->m_fileLogger.reset(new CFileLogger(executable(), logPath));
|
||||
this->m_fileLogger->changeLogPattern(CLogPattern().withSeverityAtOrAbove(CStatusMessage::SeverityDebug));
|
||||
}
|
||||
|
||||
@@ -172,10 +172,6 @@ namespace BlackCore
|
||||
//! Clear the caches
|
||||
static QStringList clearCaches();
|
||||
|
||||
//! Returns the directory of the application. In contrast to QCoreApplication::applicationDirPath()
|
||||
//! it takes Mac OS X app bundles into account and returns the directory of the bundle.
|
||||
static QString applicationDirPath();
|
||||
|
||||
// ----------------------- parsing ----------------------------------------
|
||||
|
||||
//! \name parsing of command line options
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
#include "blackcore/pluginmanager.h"
|
||||
#include "blackcore/application.h"
|
||||
#include "blackmisc/directoryutils.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
#include <QDirIterator>
|
||||
#include <QJsonValue>
|
||||
@@ -55,7 +55,7 @@ namespace BlackCore
|
||||
|
||||
QString IPluginManager::pluginDirectory() const
|
||||
{
|
||||
return sApp->applicationDirPath() % QStringLiteral("/plugins");
|
||||
return CDirectoryUtils::applicationDirectoryPath() % QStringLiteral("/plugins");
|
||||
}
|
||||
|
||||
bool IPluginManager::isValid(const QJsonObject &metadata) const
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
#include "blackcore/application.h"
|
||||
#include "blackcore/pluginmanagersimulator.h"
|
||||
#include "blackcore/simulator.h"
|
||||
#include "blackmisc/directoryutils.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonValue>
|
||||
#include <QStringBuilder>
|
||||
@@ -103,7 +103,7 @@ namespace BlackCore
|
||||
|
||||
QString CPluginManagerSimulator::pluginDirectory() const
|
||||
{
|
||||
return sApp->applicationDirPath() % QStringLiteral("/plugins/simulator");
|
||||
return CDirectoryUtils::applicationDirectoryPath() % QStringLiteral("/plugins/simulator");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
#include "blackcore/application.h"
|
||||
#include "blackcore/pluginmanagerweatherdata.h"
|
||||
#include "blackcore/weatherdata.h"
|
||||
#include "blackmisc/directoryutils.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonValue>
|
||||
#include <QStringBuilder>
|
||||
@@ -67,7 +67,7 @@ namespace BlackCore
|
||||
|
||||
QString CPluginManagerWeatherData::pluginDirectory() const
|
||||
{
|
||||
return sApp->applicationDirPath() % QStringLiteral("/plugins/weatherdata");
|
||||
return CDirectoryUtils::applicationDirectoryPath() % QStringLiteral("/plugins/weatherdata");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user