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

Method Base64GzipEncodeFile

Source/cmCTest.cxx:1240–1265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1238}
1239
1240std::string cmCTest::Base64GzipEncodeFile(std::string const& file)
1241{
1242 // Temporarily change to the file's directory so the tar gets created
1243 // with a flat directory structure.
1244 cmWorkingDirectory workdir(cmSystemTools::GetParentDirectory(file));
1245 if (workdir.Failed()) {
1246 cmCTestLog(this, ERROR_MESSAGE, workdir.GetError() << std::endl);
1247 return "";
1248 }
1249
1250 std::string tarFile = file + "_temp.tar.gz";
1251 std::vector<std::string> files;
1252 files.push_back(file);
1253
1254 if (!cmSystemTools::CreateTar(tarFile, files, {},
1255 cmSystemTools::TarCompressGZip, false)) {
1256 cmCTestLog(this, ERROR_MESSAGE,
1257 "Error creating tar while "
1258 "encoding file: "
1259 << file << std::endl);
1260 return "";
1261 }
1262 std::string base64 = this->Base64EncodeFile(tarFile);
1263 cmSystemTools::RemoveFile(tarFile);
1264 return base64;
1265}
1266
1267std::string cmCTest::Base64EncodeFile(std::string const& file)
1268{

Callers 1

AttachFileMethod · 0.80

Calls 4

Base64EncodeFileMethod · 0.95
FailedMethod · 0.80
push_backMethod · 0.80
GetErrorMethod · 0.45

Tested by

no test coverage detected