| 110 | } |
| 111 | |
| 112 | void StdFileSystem::write_file(const Path &path, const std::vector<uint8_t> &data) |
| 113 | { |
| 114 | // create directory if it doesn't exist |
| 115 | auto parent = path.parent_path(); |
| 116 | if (!std::filesystem::exists(parent)) |
| 117 | { |
| 118 | create_directory(parent); |
| 119 | } |
| 120 | |
| 121 | std::ofstream file{path, std::ios::binary | std::ios::trunc}; |
| 122 | |
| 123 | if (!file.is_open()) |
| 124 | { |
| 125 | throw std::runtime_error("Failed to open file for writing at path: " + path.string()); |
| 126 | } |
| 127 | |
| 128 | file.write(reinterpret_cast<const char *>(data.data()), data.size()); |
| 129 | } |
| 130 | |
| 131 | void StdFileSystem::remove(const Path &path) |
| 132 | { |
nothing calls this directly
no test coverage detected