| 148 | } |
| 149 | |
| 150 | static void create_file(const fs::path &path, const std::string &contents) { |
| 151 | if (!path.parent_path().empty()) { |
| 152 | fs::create_directories(path.parent_path()); |
| 153 | } |
| 154 | std::ofstream ofs(path, std::ios::binary); |
| 155 | if (!ofs) { |
| 156 | throw std::runtime_error("Failed to create " + path.string()); |
| 157 | } |
| 158 | ofs << contents; |
| 159 | } |
| 160 | |
| 161 | static std::string read_file(const fs::path &path) { |
| 162 | std::ifstream ifs(path, std::ios::binary); |
no test coverage detected