#pragma once #include #include #include inline const std::string init_conf(const std::string &path) { auto value_map = std::make_unique>>({ @__DEFAULT_CFG__ }); const std::string cfgpath = [&]() { if(path.empty()) return value_map->value("poi.cfg.path").value(); auto p = path; if(p.front() == '~') p.replace(0, 1, QStandardPaths::writableLocation(QStandardPaths::HomeLocation).toStdString()); return p; }(); std::fstream fs; fs.open(cfgpath, std::fstream::in); if(fs.is_open()) { value_map->read(fs); fs.close(); } Configuration::move_global(std::move(value_map)); return cfgpath; }