MCPcopy Create free account
hub / github.com/build-cpp/cmkr / create_file

Function create_file

src/cmake_generator.cpp:150–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148}
149
150static 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
161static std::string read_file(const fs::path &path) {
162 std::ifstream ifs(path, std::ios::binary);

Callers 3

generate_gitfileFunction · 0.85
generate_projectFunction · 0.85
generate_cmakeFunction · 0.85

Calls 1

emptyMethod · 0.80

Tested by

no test coverage detected