Skip to content

Commit

Permalink
settings
Browse files Browse the repository at this point in the history
  • Loading branch information
dxli committed Sep 12, 2023
1 parent d1acbde commit 2fee58e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lcUI/managers/uisettings.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#include "uisettings.h"

#include <memory>

#include <rapidjson/document.h>
#include <rapidjson/schema.h>
#include <rapidjson/ostreamwrapper.h>
#include <rapidjson/istreamwrapper.h>
#include <fstream>

#include <memory>
#include <fstream>
#include <iostream>
#include <sstream>

Expand Down Expand Up @@ -239,17 +238,18 @@ std::map<std::string, int> UiSettings::readDockSettings(std::map<std::string, in
}

rapidjson::Document UiSettings::getSettingsDocument(std::string fileName) {
std::cout<<__func__<<"("<<fileName<<")"<<std::endl;
std::unique_ptr<std::istream> settingsFile = std::make_unique<std::ifstream>(_filePaths["settings_load"] + fileName);

while (settingsFile->fail()) {
if (fileName == settingsFileName) {
std::cout << "No settings file found, loading default settings." << std::endl;
std::cout <<__func__<<"("<<settingsFileName<<"): No settings file found, loading default settings." << std::endl;
fileName = defaultSettingsFileName;
std::cout << "No settings file found, loading default settings: "<<_filePaths["settings_load"] + fileName<<std::endl;
std::cout << "Loading default settings: "<<_filePaths["settings_load"] + fileName<<std::endl;
static_cast<std::ifstream*>(settingsFile.get())->open(_filePaths["settings_load"] + fileName);
if (settingsFile->fail())
settingsFile = std::make_unique<std::istringstream>(defaultUiSettings);
if (settingsFile->fail())
return {};
}
else {
std::cout << "Default settings not found" << std::endl;
Expand Down

0 comments on commit 2fee58e

Please sign in to comment.