feat: 优化客户端跨平台配置和运行态管理
This commit is contained in:
@@ -1,17 +1,24 @@
|
||||
#include "LocalStateHelper.h"
|
||||
#include "ConfigHelper.h"
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QJsonDocument>
|
||||
|
||||
LocalStateHelper::LocalStateHelper(const QString& baseDir)
|
||||
: m_baseDir(baseDir)
|
||||
, m_filePath(baseDir + "/config/local_state.json")
|
||||
{
|
||||
}
|
||||
|
||||
bool LocalStateHelper::loadState(const QString& relativePath)
|
||||
{
|
||||
m_filePath = m_baseDir + "/" + relativePath;
|
||||
LocalStateHelper::LocalStateHelper(const QString& baseDir)
|
||||
: m_baseDir(baseDir)
|
||||
, m_filePath(ConfigHelper::instance().localStatePath())
|
||||
{
|
||||
}
|
||||
|
||||
bool LocalStateHelper::loadState(const QString& relativePath)
|
||||
{
|
||||
const QString defaultState = QStringLiteral("config/local_state.json");
|
||||
if (relativePath == defaultState)
|
||||
m_filePath = ConfigHelper::instance().localStatePath();
|
||||
else if (QDir::isAbsolutePath(relativePath))
|
||||
m_filePath = relativePath;
|
||||
else
|
||||
m_filePath = m_baseDir + "/" + relativePath;
|
||||
QFile file(m_filePath);
|
||||
if (!file.exists())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user