MCPcopy Create free account
hub / github.com/Kitware/CMake / SaveToFile

Method SaveToFile

Source/cmCxxModuleMetadata.cxx:412–436  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

410}
411
412cmCxxModuleMetadata::SaveResult cmCxxModuleMetadata::SaveToFile(
413 std::string const& path, cmCxxModuleMetadata const& meta)
414{
415 SaveResult st;
416
417 cmGeneratedFileStream ofs(path);
418 if (!ofs.is_open()) {
419 st.Error = "Unable to open temp file for writing";
420 return st;
421 }
422
423 Json::StreamWriterBuilder wbuilder;
424 wbuilder["indentation"] = " ";
425 ofs << Json::writeString(wbuilder, ToJsonValue(meta));
426
427 ofs.Close();
428
429 if (!ofs.good()) {
430 st.Error = cmStrCat("Write failed for file: "_s, path);
431 return st;
432 }
433
434 st.Ok = true;
435 return st;
436}
437
438namespace {
439

Callers

nothing calls this directly

Calls 5

writeStringFunction · 0.85
CloseMethod · 0.80
goodMethod · 0.80
cmStrCatFunction · 0.70
is_openMethod · 0.45

Tested by

no test coverage detected