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

Method EnsureFileValid

Source/cmSarifLog.cxx:306–323  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

304}
305
306bool cmSarif::LogFileWriter::EnsureFileValid()
307{
308 // First, ensure directory exists
309 std::string const dir = cmSystemTools::GetFilenamePath(this->FilePath);
310 if (!cmSystemTools::FileIsDirectory(dir)) {
311 if (!this->CreateDirectories ||
312 !cmSystemTools::MakeDirectory(dir).IsSuccess()) {
313 return false;
314 }
315 }
316
317 // Open the file for writing
318 cmsys::ofstream outputFile(this->FilePath.c_str());
319 if (!outputFile.good()) {
320 return false;
321 }
322 return true;
323}
324
325cmSarif::LogFileWriter::WriteResult cmSarif::LogFileWriter::TryWrite()
326{

Callers 2

TryWriteMethod · 0.95
ConfigureForCMakeRunMethod · 0.95

Calls 2

c_strMethod · 0.80
goodMethod · 0.80

Tested by

no test coverage detected