|
Post by Manuel on Apr 13, 2005 3:04:11 GMT -5
Hi, my app has to modify an archive, if i add a file (via ZipFromStream) which is allready existing in the archive, it becomes duplicated, on the second run i got an error. Is there a way to overwrite files in the archive? If i delete the existing file in the archive first(via FileList and DeleteEntries) it lasts a very long time(about 1-2sec! for a few kb file in an small archive with 20 files,or so). Is there a faster way??
thanks, Manuel
|
|
|
Post by Manuel on Apr 13, 2005 6:37:53 GMT -5
Why does this gave an "duplicate object index" exception?? ... filename:='blah/blupp.txt'; for i:=1 to 3 do begin zip.ClearZip; zip.ZipName:='c:\test.zip'; zip.ZipFromStream(memstream,filename); zip.SaveModifiedZipFile; end;
if filename doesn't contain subdirectories (eg. filename:='blupp.txt') it works. I'am too stupid, or is that a bug???
|
|
|
Post by Kevin on Apr 13, 2005 8:10:04 GMT -5
Manuel,
First, you don't need to call SaveModifiedZipFile, so you can remove that. That is only needed when you change something that does not require zipping, like when you change a filename or pathname or something like that.
Second, you probably want to set StorePaths := True. I think that MIGHT fix your problem. Let me know.
Kevin
|
|
|
Post by Manuel on Apr 13, 2005 8:41:36 GMT -5
hi,
nope, StorePath is set. (in fact, despite setting StorePath to false creates a directory in the archive using ZipFromStream/Buffer) files become duplicated (why does TSortedObjectList.Insert() handle the first duplicated file wrong (DupIgnore) ?) if 2 duplicated files are allready in the archive then the duplicate object index exception occures.. (if there are 2 same files in the zip, winrar says the archive is destroyed...)
|
|
|
Post by Kevin on Apr 13, 2005 13:17:04 GMT -5
Instead of forward slashes use backslashes. That is instead of 'blah/blupp.txt' try 'blah\blupp.txt'.
Kevin
|
|