nergall2 <yudil...@gmail.com> added the comment:

I wasn't aware of this issue and opened another one which I just closed as a 
duplicate -
https://bugs.python.org/issue40175

I also submitted a PR for the other one -
https://github.com/python/cpython/pull/19336

The implementation does involve shifting the bytes of the files and updating 
the offset of each file in the central directory.
I do handle the case in which the central directory order and the order of the 
actual files in the archive isn't the same simply by sorting the central 
directory in memory before execution.

The only issue I see here is the fact that if something happens during the 
process, the archive might get corrupted - but IMO it's worth it.
Many tools provide that functionality (Windows, Total Commander) and as far as 
I know they do it in place.
In the worst case, it's possible to implement it by creating a temp archive 
like Serhiy suggested - not too difficult to implement either since it simply 
requires duplicating the file and operating on it.

----------
nosy: +nergall2

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue6818>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to