|
@@ -47,7 +47,7 @@ struct cmArchiveWrite::Callback
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
//----------------------------------------------------------------------------
|
|
|
-cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress c):
|
|
|
|
|
|
|
+cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress c, Type t):
|
|
|
Stream(os),
|
|
Stream(os),
|
|
|
Archive(archive_write_new()),
|
|
Archive(archive_write_new()),
|
|
|
Disk(archive_read_disk_new()),
|
|
Disk(archive_read_disk_new()),
|
|
@@ -79,11 +79,47 @@ cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress c):
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
|
|
+ case CompressLZMA:
|
|
|
|
|
+ if(archive_write_set_compression_lzma(this->Archive) != ARCHIVE_OK)
|
|
|
|
|
+ {
|
|
|
|
|
+ this->Error = "archive_write_set_compression_lzma: ";
|
|
|
|
|
+ this->Error += archive_error_string(this->Archive);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
};
|
|
};
|
|
|
- archive_read_disk_set_standard_lookup(this->Disk);
|
|
|
|
|
- if(archive_write_set_format_pax_restricted(this->Archive) != ARCHIVE_OK)
|
|
|
|
|
|
|
+#if !defined(_WIN32) || defined(__CYGWIN__)
|
|
|
|
|
+ if (archive_read_disk_set_standard_lookup(this->Disk) != ARCHIVE_OK)
|
|
|
|
|
+ {
|
|
|
|
|
+ this->Error = "archive_read_disk_set_standard_lookup: ";
|
|
|
|
|
+ this->Error += archive_error_string(this->Archive);
|
|
|
|
|
+ return;;
|
|
|
|
|
+ }
|
|
|
|
|
+#endif
|
|
|
|
|
+ switch (t)
|
|
|
|
|
+ {
|
|
|
|
|
+ case TypeZIP:
|
|
|
|
|
+ if(archive_write_set_format_zip(this->Archive) != ARCHIVE_OK)
|
|
|
|
|
+ {
|
|
|
|
|
+ this->Error = "archive_write_set_format_zip: ";
|
|
|
|
|
+ this->Error += archive_error_string(this->Archive);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ case TypeTAR:
|
|
|
|
|
+ if(archive_write_set_format_pax_restricted(this->Archive) != ARCHIVE_OK)
|
|
|
|
|
+ {
|
|
|
|
|
+ this->Error = "archive_write_set_format_pax_restricted: ";
|
|
|
|
|
+ this->Error += archive_error_string(this->Archive);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // do not pad the last block!!
|
|
|
|
|
+ if (archive_write_set_bytes_in_last_block(this->Archive, 1))
|
|
|
{
|
|
{
|
|
|
- this->Error = "archive_write_set_format_pax_restricted: ";
|
|
|
|
|
|
|
+ this->Error = "archive_write_set_bytes_in_last_block: ";
|
|
|
this->Error += archive_error_string(this->Archive);
|
|
this->Error += archive_error_string(this->Archive);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|