I am the maintainer of ArchiveAccess, an access software for archives:
https://sourceforge.net/projects/archiveaccess/
ArchiveAccess uses libunshield to unpack .cab files. ArchiveAccess provides data about files that can be unpacked, to allow the user to choose what to inspect closer. I currently obtain this information via unshield_get_file_descriptor:
UnshieldFileGroup* file_group = unshield_file_group_get(mUnshieldData, i);
if (file_group != nullptr) {
for (unsigned int j = file_group->first_file; j <= file_group->last_file; j++) {
CPString filename = CPString(unshield_file_name(mUnshieldData, j), (Codepage)fncp);
CPString dirName = CPString(file_group->name, (Codepage)fncp);
FileDescriptor* fd = unshield_get_file_descriptor(mUnshieldData, j);
...
fileInfo.UncompressedFileSize = fd->expanded_size;
fileInfo.CompressedFileSize = fd->compressed_size;
fileInfo.attributes = fd->flags;
In order to do this, I export the function unshield_get_file_descriptor, which is an internal function in official builds. However, a cleaner way to do this would be via proper access functions. I propose to provide several access functions:
uint64_t unshield_get_uncompressed_size(Unshield* unshield, UnshieldFileGroup* file_group, int index);
uint64_t unshield_get_compressed_size(Unshield* unshield, UnshieldFileGroup* file_group, int index);
uint32_t unshield_get_attributes(Unshield* unshield, UnshieldFileGroup* file_group, int index);
There are other ways, like exposing all this data via one function, but these approaches would be less flexible. My questions:
- If I would implement this, would you accept it in libunshield, or you would you rather go a different route?
- Did I miss that there is a feature for doing this already?
Thanks in advance
Björn
I am the maintainer of ArchiveAccess, an access software for archives:
https://sourceforge.net/projects/archiveaccess/
ArchiveAccess uses libunshield to unpack .cab files. ArchiveAccess provides data about files that can be unpacked, to allow the user to choose what to inspect closer. I currently obtain this information via unshield_get_file_descriptor:
UnshieldFileGroup* file_group = unshield_file_group_get(mUnshieldData, i);
if (file_group != nullptr) {
for (unsigned int j = file_group->first_file; j <= file_group->last_file; j++) {
CPString filename = CPString(unshield_file_name(mUnshieldData, j), (Codepage)fncp);
CPString dirName = CPString(file_group->name, (Codepage)fncp);
FileDescriptor* fd = unshield_get_file_descriptor(mUnshieldData, j);
...
fileInfo.UncompressedFileSize = fd->expanded_size;
fileInfo.CompressedFileSize = fd->compressed_size;
fileInfo.attributes = fd->flags;
In order to do this, I export the function unshield_get_file_descriptor, which is an internal function in official builds. However, a cleaner way to do this would be via proper access functions. I propose to provide several access functions:
uint64_t unshield_get_uncompressed_size(Unshield* unshield, UnshieldFileGroup* file_group, int index);
uint64_t unshield_get_compressed_size(Unshield* unshield, UnshieldFileGroup* file_group, int index);
uint32_t unshield_get_attributes(Unshield* unshield, UnshieldFileGroup* file_group, int index);
There are other ways, like exposing all this data via one function, but these approaches would be less flexible. My questions:
Thanks in advance
Björn