| 1238 | } |
| 1239 | |
| 1240 | std::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 | |
| 1267 | std::string cmCTest::Base64EncodeFile(std::string const& file) |
| 1268 | { |
no test coverage detected