MCPcopy Create free account
hub / github.com/OpenHD/OpenHD / write_file

Method write_file

OpenHD/ohd_common/src/openhd_util_filesystem.cpp:122–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122void OHDFilesystemUtil::write_file(const std::string &path,
123 const std::string &content) {
124 try {
125 std::ofstream t(path);
126 if (!t.good()) {
127 openhd::log::get_default()->warn("Cannot open file [{}]", path);
128 }
129 t << content;
130 t.close();
131 if (!t.good()) {
132 openhd::log::get_default()->warn("Cannot write file [{}]", path);
133 }
134 } catch (std::exception &e) {
135 openhd::log::get_default()->warn("Cannot write file [{}] {}", path,
136 e.what());
137 }
138}
139
140std::optional<std::string> OHDFilesystemUtil::opt_read_file(
141 const std::string &filename, bool log_debug) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected