Fix path to QStandardPaths::ConfigLocation.
This commit is contained in:
parent
f72d235344
commit
d331b5dc01
|
@ -33,6 +33,12 @@
|
||||||
#include "../projectversion.h"
|
#include "../projectversion.h"
|
||||||
#include "vcrashpaths.h"
|
#include "vcrashpaths.h"
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
|
||||||
|
#include "../compatibility.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using namespace Qt::Literals::StringLiterals;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VCrashPaths::VCrashPaths(QString exeDir)
|
VCrashPaths::VCrashPaths(QString exeDir)
|
||||||
: m_exeDir(std::move(exeDir))
|
: m_exeDir(std::move(exeDir))
|
||||||
|
@ -42,9 +48,18 @@ VCrashPaths::VCrashPaths(QString exeDir)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VCrashPaths::GetAttachmentPath(const QString &appName) -> QString
|
auto VCrashPaths::GetAttachmentPath(const QString &appName) -> QString
|
||||||
{
|
{
|
||||||
const QString logDirPath =
|
QString logDirPath = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation);
|
||||||
QStandardPaths::locate(QStandardPaths::ConfigLocation, QString(), QStandardPaths::LocateDirectory) +
|
if (logDirPath.isEmpty())
|
||||||
QStringLiteral(VER_COMPANYNAME_STR);
|
{
|
||||||
|
QString const logDirName = VER_COMPANYNAME_STR + "Logs"_L1;
|
||||||
|
#if defined(Q_OS_LINUX) || defined(Q_OS_MACOS)
|
||||||
|
logDirPath =
|
||||||
|
QDir::homePath() + QDir::separator() + logDirName + QDir::separator() + QCoreApplication::applicationName();
|
||||||
|
#else
|
||||||
|
logDirPath = QCoreApplication::applicationDirPath() + QDir::separator() + logDirName + QDir::separator() +
|
||||||
|
QCoreApplication::applicationName();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
return QStringLiteral("%1/%2-pid%3.log").arg(logDirPath, appName.toLower()).arg(QCoreApplication::applicationPid());
|
return QStringLiteral("%1/%2-pid%3.log").arg(logDirPath, appName.toLower()).arg(QCoreApplication::applicationPid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,14 +79,14 @@ auto VCrashPaths::GetHandlerPath() const -> QString
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VCrashPaths::GetReportsPath() -> QString
|
auto VCrashPaths::GetReportsPath() -> QString
|
||||||
{
|
{
|
||||||
return QStandardPaths::locate(QStandardPaths::AppConfigLocation, QString(), QStandardPaths::LocateDirectory) +
|
return QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + QDir::separator() +
|
||||||
QStringList{VER_COMPANYNAME_STR, "User Data", "Crashpad", "Reports"}.join(QDir::separator());
|
QStringList{VER_COMPANYNAME_STR, "User Data", "Crashpad", "Reports"}.join(QDir::separator());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VCrashPaths::GetMetricsPath() -> QString
|
auto VCrashPaths::GetMetricsPath() -> QString
|
||||||
{
|
{
|
||||||
return QStandardPaths::locate(QStandardPaths::AppConfigLocation, QString(), QStandardPaths::LocateDirectory) +
|
return QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + QDir::separator() +
|
||||||
QStringList{VER_COMPANYNAME_STR, "User Data", "Crashpad", "Metrics"}.join(QDir::separator());
|
QStringList{VER_COMPANYNAME_STR, "User Data", "Crashpad", "Metrics"}.join(QDir::separator());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -555,7 +555,7 @@ void VAbstractApplication::CheckSystemLocale()
|
||||||
|
|
||||||
auto CheckLanguage = [](QStandardPaths::StandardLocation type, const QStringList &test)
|
auto CheckLanguage = [](QStandardPaths::StandardLocation type, const QStringList &test)
|
||||||
{
|
{
|
||||||
const QString path = QStandardPaths::locate(type, QString(), QStandardPaths::LocateDirectory);
|
const QString path = QStandardPaths::writableLocation(type);
|
||||||
return std::any_of(test.begin(), test.end(), [path](const QString &t) { return path.contains(t); });
|
return std::any_of(test.begin(), test.end(), [path](const QString &t) { return path.contains(t); });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -635,9 +635,18 @@ void VAbstractApplication::InitHighDpiScaling(int argc, char *argv[])
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VAbstractApplication::LogDirPath() -> QString
|
auto VAbstractApplication::LogDirPath() -> QString
|
||||||
{
|
{
|
||||||
const QString logDirPath =
|
QString logDirPath = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation);
|
||||||
QStandardPaths::locate(QStandardPaths::ConfigLocation, QString(), QStandardPaths::LocateDirectory) +
|
if (logDirPath.isEmpty())
|
||||||
QCoreApplication::organizationName();
|
{
|
||||||
|
QString const logDirName = QCoreApplication::organizationName() + "Logs"_L1;
|
||||||
|
#if defined(Q_OS_LINUX) || defined(Q_OS_MACOS)
|
||||||
|
logDirPath =
|
||||||
|
QDir::homePath() + QDir::separator() + logDirName + QDir::separator() + QCoreApplication::applicationName();
|
||||||
|
#else
|
||||||
|
logDirPath = QCoreApplication::applicationDirPath() + QDir::separator() + logDirName + QDir::separator() +
|
||||||
|
QCoreApplication::applicationName();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
return logDirPath;
|
return logDirPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user