in text/text.cpp [18:37]
std::map<std::string, std::string> readConfig(const std::string &filename) {
std::map<std::string, std::string> config;
std::ifstream file(filename);
if (!file.is_open()) {
throw std::runtime_error("Could not open config file");
}
std::string line;
while (std::getline(file, line)) {
std::istringstream is_line(line);
std::string key;
if (std::getline(is_line, key, '=')) {
std::string value;
if (std::getline(is_line, value)) {
config[key] = value;
}
}
}
return config;
}