summaryrefslogtreecommitdiffstats
path: root/Source/cmArchiveWrite.cxx
diff options
context:
space:
mode:
authorBartosz Kosiorek <bartosz.kosiorek@tomtom.com>2019-03-08 13:53:35 (GMT)
committerBartosz Kosiorek <bartosz.kosiorek@tomtom.com>2019-03-18 16:55:35 (GMT)
commit8634576dcb03087fc507b8012a47f1ecc852f65f (patch)
tree47418b14525ece43b52697e9a82c1129d157d813 /Source/cmArchiveWrite.cxx
parentc7c6a4a2cc06fd22eeb1c545dba030eddf39363a (diff)
downloadCMake-8634576dcb03087fc507b8012a47f1ecc852f65f.zip
CMake-8634576dcb03087fc507b8012a47f1ecc852f65f.tar.gz
CMake-8634576dcb03087fc507b8012a47f1ecc852f65f.tar.bz2
cmake: Don't interrupt archive creation if unable to read a file.
Rationale: Currently during creation of archive by 'tar', if error appears, it interrupt archive creation. As a result only part of files are archived This behaviour is not consistent with 'copy_directory', native 'tar' and other command behaviour. With this Merge Request this behaviour is fixed.
Diffstat (limited to 'Source/cmArchiveWrite.cxx')
-rw-r--r--Source/cmArchiveWrite.cxx11
1 files changed, 5 insertions, 6 deletions
diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx
index 23be603..177ba02 100644
--- a/Source/cmArchiveWrite.cxx
+++ b/Source/cmArchiveWrite.cxx
@@ -179,12 +179,10 @@ cmArchiveWrite::~cmArchiveWrite()
bool cmArchiveWrite::Add(std::string path, size_t skip, const char* prefix,
bool recursive)
{
- if (this->Okay()) {
- if (!path.empty() && path.back() == '/') {
- path.erase(path.size() - 1);
- }
- this->AddPath(path.c_str(), skip, prefix, recursive);
+ if (!path.empty() && path.back() == '/') {
+ path.erase(path.size() - 1);
}
+ this->AddPath(path.c_str(), skip, prefix, recursive);
return this->Okay();
}
@@ -220,6 +218,7 @@ bool cmArchiveWrite::AddPath(const char* path, size_t skip, const char* prefix,
bool cmArchiveWrite::AddFile(const char* file, size_t skip, const char* prefix)
{
+ this->Error = "";
// Skip the file if we have no name for it. This may happen on a
// top-level directory, which does not need to be included anyway.
if (skip >= strlen(file)) {
@@ -241,7 +240,7 @@ bool cmArchiveWrite::AddFile(const char* file, size_t skip, const char* prefix)
cm_archive_entry_copy_pathname(e, dest);
if (archive_read_disk_entry_from_file(this->Disk, e, -1, nullptr) !=
ARCHIVE_OK) {
- this->Error = "archive_read_disk_entry_from_file '";
+ this->Error = "Unable to read from file '";
this->Error += file;
this->Error += "': ";
this->Error += cm_archive_error_string(this->Disk);