mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 21:00:05 +00:00
Settings manager fixes for directory creation
This commit is contained in:
parent
5214f866d4
commit
5cbe986734
2 changed files with 3 additions and 6 deletions
|
|
@ -26,28 +26,25 @@ static boost::json::value ConvertSettingsToJson();
|
|||
static void GenerateDefaultSettings();
|
||||
static bool LoadSettings(const boost::json::object& settingsJson);
|
||||
|
||||
bool Initialize()
|
||||
void Initialize()
|
||||
{
|
||||
std::string appDataPath {
|
||||
QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)
|
||||
.toStdString()};
|
||||
|
||||
if (!std::filesystem::is_directory(appDataPath))
|
||||
if (!std::filesystem::exists(appDataPath))
|
||||
{
|
||||
if (!std::filesystem::create_directories(appDataPath))
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(error)
|
||||
<< logPrefix_ << "Unable to create application data directory: \""
|
||||
<< appDataPath << "\"";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
std::string settingsPath {appDataPath + "/settings.json"};
|
||||
|
||||
ReadSettings(settingsPath);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ReadSettings(const std::string& settingsPath)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace manager
|
|||
namespace SettingsManager
|
||||
{
|
||||
|
||||
bool Initialize();
|
||||
void Initialize();
|
||||
void ReadSettings(const std::string& settingsPath);
|
||||
|
||||
std::shared_ptr<settings::GeneralSettings> general_settings();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue