Closed sheikn closed 5 years ago
Hi! First of all, sorry for the late response and thanks for using bit7z!
Does this library support adding files to an existing archive?
No, at the moment the library does not support updating already existing archives.
The class BitCompressor
, specifically, is meant to be used for creating different output archives.
However it is a functionality that, sooner or later, I would like to add to the library.
The most difficult problems that I encounter when adding new functionalities like this is to design a simple and easy to use API and, above all, find the way to exploit the 7z to implement it (due to the poor documentation).
I'm trying to solve all these issues and come up with a new bit7z version as soon as possible!
If not, is there some other way of doing what I'm after using this library (i.e add a list of files, then add a secondary list of files to the same archive)?
If updating is not strictly mandatory, you could use the compress
function of BitCompressor
, which takes a list of both files and directories and compresses them all together (directories are compressed recursively).
I hope that this fits your usage requirements!
@rikyoz thanks for your work! I really like bit7z!
I'm trying to add some files to an existing archive (zip file). However, I get error "Can't create archive file".
My code for doing this is as follows
bit7z::BitCompressor compressor(lib, bit7z::BitFormat::Zip);
std::vector<std::wstring> rootFiles = Utilities::getAllFilesInDir(tmpPath, include, exclude, false);
compressor.compressFiles(rootFiles, outputfile); // 1. compress list of files
vector<wstring> dirList = Utilities::getSubDirectoryList(tmpPath);
for (auto str : dirList) {
wstring dirName = str;
compressor.compressDirectory(dirName, outputfile, true); // 2. compress a secondary list of dirs
// more code follows here
The first compressor.compressFiles call succeeds. The compressor.compressDirectory however fails. Does this library support adding files to an existing archive?
If not, is there some other way of doing what I'm after using this library (i.e add a list of files, then add a secondary list of files to the same archive)?