Message109158
I have attempted to implement a ZipFile.remove function. It seems to work fine. I have submitted a patch.
The method of implementation is: find the file's index in the file list, then sum the lengths of the file entries before it to find its location in the archive. Then simply read in all the bytes after it, write them out at that location, and truncate the file x bytes shorter, where x is the length of the record. This works because the directory listing is created when the file is closed, so there's no harm in truncating.
I've also made it truncate the zip file after reading in the existing files upon creation, because the directory information is not used after this point.
This could use some testing on large files.
This is my first patch, so let me know if I've done anything wrong. |
|
Date |
User |
Action |
Args |
2010-07-03 05:26:43 | chroipahtz | set | recipients:
+ chroipahtz, loewis, rhettinger, lars.gustaebel, rossmclendon, victorlee129 |
2010-07-03 05:26:42 | chroipahtz | set | messageid: <1278134802.59.0.82246408284.issue6818@psf.upfronthosting.co.za> |
2010-07-03 05:26:40 | chroipahtz | link | issue6818 messages |
2010-07-03 05:26:39 | chroipahtz | create | |
|