mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-16 05:26:58 +08:00
cmSystemTools: std::string parameters for tar functions
This commit is contained in:

committed by
Brad King

parent
7c39a9c6b6
commit
57cedb18c0
@@ -1611,8 +1611,8 @@ std::string cmCTest::Base64GzipEncodeFile(std::string const& file)
|
||||
std::vector<std::string> files;
|
||||
files.push_back(file);
|
||||
|
||||
if (!cmSystemTools::CreateTar(tarFile.c_str(), files,
|
||||
cmSystemTools::TarCompressGZip, false)) {
|
||||
if (!cmSystemTools::CreateTar(tarFile, files, cmSystemTools::TarCompressGZip,
|
||||
false)) {
|
||||
cmCTestLog(this, ERROR_MESSAGE,
|
||||
"Error creating tar while "
|
||||
"encoding file: "
|
||||
|
@@ -1529,7 +1529,7 @@ bool cmSystemTools::IsPathToFramework(const std::string& path)
|
||||
cmHasLiteralSuffix(path, ".framework"));
|
||||
}
|
||||
|
||||
bool cmSystemTools::CreateTar(const char* outFileName,
|
||||
bool cmSystemTools::CreateTar(const std::string& outFileName,
|
||||
const std::vector<std::string>& files,
|
||||
cmTarCompression compressType, bool verbose,
|
||||
std::string const& mtime,
|
||||
@@ -1537,7 +1537,7 @@ bool cmSystemTools::CreateTar(const char* outFileName,
|
||||
{
|
||||
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
||||
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
|
||||
cmsys::ofstream fout(outFileName, std::ios::out | std::ios::binary);
|
||||
cmsys::ofstream fout(outFileName.c_str(), std::ios::out | std::ios::binary);
|
||||
if (!fout) {
|
||||
std::string e = "Cannot open output file \"";
|
||||
e += outFileName;
|
||||
@@ -1757,7 +1757,7 @@ bool copy_data(struct archive* ar, struct archive* aw)
|
||||
# endif
|
||||
}
|
||||
|
||||
bool extract_tar(const char* outFileName,
|
||||
bool extract_tar(const std::string& outFileName,
|
||||
const std::vector<std::string>& files, bool verbose,
|
||||
bool extract)
|
||||
{
|
||||
@@ -1783,7 +1783,7 @@ bool extract_tar(const char* outFileName,
|
||||
}
|
||||
}
|
||||
|
||||
int r = cm_archive_read_open_file(a, outFileName, 10240);
|
||||
int r = cm_archive_read_open_file(a, outFileName.c_str(), 10240);
|
||||
if (r) {
|
||||
ArchiveError("Problem with archive_read_open_file(): ", a);
|
||||
archive_write_free(ext);
|
||||
@@ -1878,7 +1878,7 @@ bool extract_tar(const char* outFileName,
|
||||
}
|
||||
#endif
|
||||
|
||||
bool cmSystemTools::ExtractTar(const char* outFileName,
|
||||
bool cmSystemTools::ExtractTar(const std::string& outFileName,
|
||||
const std::vector<std::string>& files,
|
||||
bool verbose)
|
||||
{
|
||||
@@ -1892,7 +1892,7 @@ bool cmSystemTools::ExtractTar(const char* outFileName,
|
||||
#endif
|
||||
}
|
||||
|
||||
bool cmSystemTools::ListTar(const char* outFileName,
|
||||
bool cmSystemTools::ListTar(const std::string& outFileName,
|
||||
const std::vector<std::string>& files,
|
||||
bool verbose)
|
||||
{
|
||||
|
@@ -450,14 +450,14 @@ public:
|
||||
TarCompressNone
|
||||
};
|
||||
|
||||
static bool ListTar(const char* outFileName,
|
||||
static bool ListTar(const std::string& outFileName,
|
||||
const std::vector<std::string>& files, bool verbose);
|
||||
static bool CreateTar(const char* outFileName,
|
||||
static bool CreateTar(const std::string& outFileName,
|
||||
const std::vector<std::string>& files,
|
||||
cmTarCompression compressType, bool verbose,
|
||||
std::string const& mtime = std::string(),
|
||||
std::string const& format = std::string());
|
||||
static bool ExtractTar(const char* inFileName,
|
||||
static bool ExtractTar(const std::string& inFileName,
|
||||
const std::vector<std::string>& files, bool verbose);
|
||||
// This should be called first thing in main
|
||||
// it will keep child processes from inheriting the
|
||||
|
@@ -1127,7 +1127,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
|
||||
return 1;
|
||||
}
|
||||
if (action == cmSystemTools::TarActionList) {
|
||||
if (!cmSystemTools::ListTar(outFile.c_str(), files, verbose)) {
|
||||
if (!cmSystemTools::ListTar(outFile, files, verbose)) {
|
||||
cmSystemTools::Error("Problem listing tar: " + outFile);
|
||||
return 1;
|
||||
}
|
||||
@@ -1136,13 +1136,13 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
|
||||
cmSystemTools::Message("tar: No files or directories specified",
|
||||
"Warning");
|
||||
}
|
||||
if (!cmSystemTools::CreateTar(outFile.c_str(), files, compress,
|
||||
verbose, mtime, format)) {
|
||||
if (!cmSystemTools::CreateTar(outFile, files, compress, verbose, mtime,
|
||||
format)) {
|
||||
cmSystemTools::Error("Problem creating tar: " + outFile);
|
||||
return 1;
|
||||
}
|
||||
} else if (action == cmSystemTools::TarActionExtract) {
|
||||
if (!cmSystemTools::ExtractTar(outFile.c_str(), files, verbose)) {
|
||||
if (!cmSystemTools::ExtractTar(outFile, files, verbose)) {
|
||||
cmSystemTools::Error("Problem extracting tar: " + outFile);
|
||||
return 1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user