Description
This is definitely a feature that users want in a library like this. Modification of existing archives and the creation of new archives are much more complex than simple reading and extraction. I have a few ideas about how this should be implemented in a clean and mostly format-neutral way.
Changesets
For modification of archives, I have the idea of changesets, essentially sequential operations to be done on the archive. Think of how GParted works: you can manipulate your partitions and each change adds an item to a list of changes, then at the end you apply the changes.
Changes can be split into two types: those which require re-building the archive and those which can be done "in-place". Of course, some changes may be doable in-place in some kinds of archive but only by rebuilding in others, so not all changes are equal.
Some potential in-place changes:
- Replacing a file in a non-compressed archive with a file of equal or lesser size
- Renaming a file in some archives with a filename of equal or lesser size
- Deleting a file in some kinds of archives
- Adding a file, in archives that come with extra space by default (like ISO images)
Potential rebuilding changes:
- Adding a file or directory in most archives
- Replacing a file with a file of greater size
- Deleting a file in some kinds of archives
Roadmap
Naturally, the in-place changes will be easier to implement, while the rebuilding changes require essentially creating a new archive from scratch. I think that first the in-place changes will be implemented, then archive creation will be implemented, then re-building changes will be implemented. I won't put a solid timeframe on anything since this is purely a free-time project, but I hope to get this functionality working within the next few months.
This is of course an open-source project so any suggestions or code contributions are always welcome