rikyoz / bit7z

A C++ static library offering a clean and simple interface to the 7-zip shared libraries.
https://rikyoz.github.io/bit7z
Mozilla Public License 2.0
602 stars 110 forks source link

[Feature Request]: Compresses files open for writing by another applications #203

Open shankun opened 2 months ago

shankun commented 2 months ago

Feature description

Just like the -ssw (Compress files open for writing) switch of 7-Zip.

Compresses files open for writing by another applications. If this switch is not set, 7-zip doesn't include such files to archive.

https://documentation.help/7-Zip/shared.htm

Additional context

No response

Code of Conduct

rikyoz commented 2 months ago

Hi! Since v4, bit7z should by default compress files opened for writing by other processes (as if using the -ssw option with 7-Zip), at least when using MSVC. Bit7z internally uses std::ifstream to open files, and by default MSVC opens files with the FILE_SHARE_READ | FILE_SHARE_WRITE flags, which are the same flags used by 7-Zip when using the -ssw option. Do you have any problem compressing files while they are already open for writing by other applications?