Could someone tell me how can I change an archive file programmatically without repacking its?
Some details:
I would like to use LZMA SDK in a commercial project.
So I implemented all needed interfaces in my code and created instance of IInArchive from 7z.dll.
Then I opened an archive file and I would like to make some changes in it. I use next algorithm for this purpose:
- creates a temporary file;
- update items, i.e. pOutArchive->UpdateItems(spStream, updataItems.GetCount(), spUpdateCallback);
- copies the temporary file to the source archive.
Therefore, my question is: may I call pOutArchive->UpdateItems in the same archive file?
I guess there can be some confusions in implementation.
Best Regards
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I suppose it can improve performance (usually it helpful for network drives).
I saw how API and 7zip algorithms interacted and I could understand why it has been done.
Also I can see unchanged files will be copied without changes from input stream to output.
Nevertheless when I use your 7Zip file manager, I don't see progress bar when I try to add new files or delete one of existing files.
Maybe there are some workarounds how to use that or maybe 7Zip file manager have background thread for this.
I don't know but I can see it doesn't require repacking an archive file.
Could you tell me some recommendations how to improve this point?
Best Regards,
Vladimir
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, 7-zip copies whole archive and repacks changed solid blocks.
Since there is file cache in Windows, it can look like RAM->RAM transferring. And then it's flushed to disk.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for your answers.
I understood, any archive file can be changed through temporary file. It's behavior by design.
What can I do? I can make some optimization in realization of IInStream/IOutStream (use a file mapping for example) which will allow to improve performance.
Thanks again.
Best Regards,
Vladimir
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello everyone,
Could someone tell me how can I change an archive file programmatically without repacking its?
Some details:
I would like to use LZMA SDK in a commercial project.
So I implemented all needed interfaces in my code and created instance of IInArchive from 7z.dll.
Then I opened an archive file and I would like to make some changes in it. I use next algorithm for this purpose:
- creates a temporary file;
- update items, i.e. pOutArchive->UpdateItems(spStream, updataItems.GetCount(), spUpdateCallback);
- copies the temporary file to the source archive.
Therefore, my question is: may I call pOutArchive->UpdateItems in the same archive file?
I guess there can be some confusions in implementation.
Best Regards
Original input stream must be readonly.
So you can't use same stream as OutSrtream.
Why do you need that feature?
Thanks Igor,
I suppose it can improve performance (usually it helpful for network drives).
I saw how API and 7zip algorithms interacted and I could understand why it has been done.
Also I can see unchanged files will be copied without changes from input stream to output.
Nevertheless when I use your 7Zip file manager, I don't see progress bar when I try to add new files or delete one of existing files.
Maybe there are some workarounds how to use that or maybe 7Zip file manager have background thread for this.
I don't know but I can see it doesn't require repacking an archive file.
Could you tell me some recommendations how to improve this point?
Best Regards,
Vladimir
Yes, 7-zip copies whole archive and repacks changed solid blocks.
Since there is file cache in Windows, it can look like RAM->RAM transferring. And then it's flushed to disk.
Igor,
Thanks for your answers.
I understood, any archive file can be changed through temporary file. It's behavior by design.
What can I do? I can make some optimization in realization of IInStream/IOutStream (use a file mapping for example) which will allow to improve performance.
Thanks again.
Best Regards,
Vladimir