Closed cobian-test closed 1 year ago
Hi!
The behavior right now is that if compressor.setUpdateMode(false); and the archive already exists, an exception is thrown.
This behavior is actually going to change with the next version (currently in beta).
The setUpdateMode
will not accept a boolean parameter anymore, but rather an enum value which can be one from UpdateMode::None
, UpdateMode::Overwrite
, and UpdateMode::Append
.
UpdateMode::None
(the default mode) will give the same behavior as the setUpdateMode(false)
in bit7z v3: if the output archive already exists, an exception is thrown.UpdateMode::Overwrite
: if the output archive already exists, then:
UpdateMode::Append
will be equivalent to the setUpdateMode(true)
in bit7z v3, with the new items appended to the already existing archive.It could be easy to fix by checking the existence of the file and deleting the archive before opening the output stream. The same (and most important) thing should be done if creating volumes, because every existing part raises an exception now.
I think it might be really useful, thanks for your suggestion!
The only problem I can see is that deleting the already existing archive might not be the best default behavior desirable by the library's user.
So what I'm probably going to do is add another update mode to the next version, something like UpdateMode::OverwriteArchive
, which should make bit7z behave just like you suggested.
Feature description
The behavior right now is that if compressor.setUpdateMode(false); and the archive already exists, an exception is thrown. It could be easy to fix by checking the existence of the file and deleting the archive before opening the output stream. The same (and most important) thing should be done if creating volumes, because every existing part raises an exception now.
Regards
Additional context
No response
Code of Conduct