Saves the current JSON object to a file.
| 45 | |
| 46 | // Saves the current JSON object to a file. |
| 47 | void ConfigFile::save(const std::string& file_path) { |
| 48 | std::ofstream file(file_path); |
| 49 | if (!file.is_open()) { throw std::runtime_error("Failed to open file for saving: " + file_path); } |
| 50 | // Write the pretty-printed version of the JSON to the file. |
| 51 | file << dump(); |
| 52 | } |
| 53 | |
| 54 | } // namespace mllm |