diff options
Diffstat (limited to 'lib/MiddleWare/Settings.cpp')
| -rw-r--r-- | lib/MiddleWare/Settings.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/MiddleWare/Settings.cpp b/lib/MiddleWare/Settings.cpp index 627bfc6..413820b 100644 --- a/lib/MiddleWare/Settings.cpp +++ b/lib/MiddleWare/Settings.cpp @@ -80,5 +80,20 @@ void load_settings(const std::string& path, map_settings_t& settings) void save_settings(const std::string& path, const map_settings_t& settings) { - //TODO: write this + map_settings_t::const_iterator it; + std::ofstream fOut; + fOut.open(path.c_str()); + if (fOut.is_open()) + { + fOut << "# !DO NOT EDIT THIS FILE BY HAND. IT IS GENERATED BY CRASHCATCHER!" << std::endl; + for (it = settings.begin(); it != settings.end(); it++) + { + fOut << it->first << " = " << it->second << std::endl << std::endl; + } + fOut.close(); + } + else + { + throw std::string("save_settings(): Cannot write configuration file '"+path+"'."); + } } |
