MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ write_generated()

bool MayaFlux::Reflect::Tool::write_generated ( const std::filesystem::path & path,
const std::string & content,
std::string & error )
nodiscard

Writes content when it differs, then marks path as modified now.

A build graph compares the timestamp of an output with its inputs. An unchanged file that kept an old timestamp would be rebuilt every time its header changes.

Returns
false with error set when the file cannot be written or touched.

Definition at line 92 of file Build.cpp.

93{
94 if (!write_if_changed(path, content, error)) {
95 return false;
96 }
97 std::error_code code;
98 std::filesystem::last_write_time(path, std::filesystem::file_time_type::clock::now(), code);
99 if (code) {
100 error = "cannot update the timestamp of " + path.string();
101 return false;
102 }
103 return true;
104}
bool write_if_changed(const std::filesystem::path &path, const std::string &content, std::string &error)
Replaces path with content only when the content differs.
Definition Sidecar.cpp:137

References write_if_changed().

Referenced by run_creator_build(), run_function_build(), and run_reflect_build().

Here is the call graph for this function:
Here is the caller graph for this function: