MCPcopy Create free account
hub / github.com/chipsalliance/Surelog / writeContent

Method writeContent

src/Common/FileSystem.cpp:162–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160}
161
162bool FileSystem::writeContent(PathId fileId, std::string_view content,
163 bool onlyIfModified) {
164 if (!fileId) return false;
165
166 if (onlyIfModified && exists(fileId)) {
167 std::string currentContent;
168 if (readContent(fileId, currentContent) && (currentContent == content)) {
169 return true;
170 }
171 }
172
173 bool result = false;
174 std::ostream &strm = openForWrite(fileId);
175 if (strm.good()) {
176 strm << content;
177 strm.flush();
178 result = strm.good();
179 }
180 close(strm);
181 return result;
182}
183
184bool FileSystem::writeContent(PathId fileId, std::string_view content) {
185 return writeContent(fileId, content, true);

Callers 4

TESTFunction · 0.80
postPreprocess_Method · 0.80
analyzeMethod · 0.80

Calls 1

flushMethod · 0.80

Tested by 1

TESTFunction · 0.64