Rename main section in settings to system
This commit is contained in:
parent
f426e3570d
commit
93cfdd5586
2 changed files with 10 additions and 4 deletions
|
@ -1,3 +1,3 @@
|
|||
[main]
|
||||
[system]
|
||||
db_path=originsro.db3
|
||||
worker_threads=3
|
||||
|
|
|
@ -28,6 +28,12 @@
|
|||
namespace duck {
|
||||
|
||||
namespace {
|
||||
constexpr const char g_db_path_sect[] = "system";
|
||||
constexpr const char g_db_path[] = "db_path";
|
||||
|
||||
constexpr const char g_worker_threads_sect[] = "system";
|
||||
constexpr const char g_worker_threads[] = "worker_threads";
|
||||
|
||||
std::string whole_ini() {
|
||||
std::ifstream input(g_config_file_path);
|
||||
input >> std::noskipws;
|
||||
|
@ -65,13 +71,13 @@ AppConfig::AppConfig() :
|
|||
AppConfig::~AppConfig() noexcept = default;
|
||||
|
||||
std::string_view AppConfig::db_path() const {
|
||||
return value_ifp(m_ini, "main", "db_path", g_def_sqlite_db_name, false);
|
||||
return value_ifp(m_ini, g_db_path_sect, g_db_path, g_def_sqlite_db_name, false);
|
||||
}
|
||||
|
||||
std::size_t AppConfig::worker_threads() const {
|
||||
std::string_view opt_name("worker_threads");
|
||||
std::string_view opt_name(g_worker_threads);
|
||||
|
||||
std::string_view val = value_ifp(m_ini, "main", opt_name, g_def_worker_threads, false);
|
||||
std::string_view val = value_ifp(m_ini, g_worker_threads_sect, opt_name, g_def_worker_threads, false);
|
||||
if (val == "max") {
|
||||
return std::max(3U, std::thread::hardware_concurrency()) - 1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue