File is locked when updating a split archive.

Dec 7, 2011 at 12:32 PM

I've two errors that are causing a bit of trouble.

I have a multi-part ZIP file that I open, make some changes and then resave.

I open the zip file with    

m_oZIP = Ionic.Zip.ZipFile.Read(m_sFinalImageFile)

I then modify the Entries with  

m_oZIP.AddFile(m_sFileName, "\")
Finally I save with
m_oZIP.Save()
Unfortunately when I do this it forgets that this is a multipart ZIP, and proceeds to save all as one large file. No Good.
I thought I'd try
m_oZIP = Ionic.Zip.ZipFile.Read(m_sFinalImageFile)
m_oZIP.MaxOutputSegmentSize = 20 * 1024 * 1024
but when I call Save on this -- it says part of the archive (usually ZipFile.z02) is in use and fails.
Cant win either way.

 

Dec 7, 2011 at 1:21 PM

some more info...

I tracked the error down to this 

   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)   at System.IO.File.Delete(String path)   at Ionic.Zip.ZipSegmentedStream._SetWriteStream(UInt32 increment) in C:\Development\Misc\Libraries\dotnetzip-85217\Zip\ZipSegmentedStream.cs:line 321   at Ionic.Zip.ZipSegmentedStream.Write(Byte[] buffer, Int32 offset, Int32 count) in C:\Development\Misc\Libraries\dotnetzip-85217\Zip\ZipSegmentedStream.cs:line 369   at Ionic.Zip.ZipEntry.CopyThroughWithRecompute(Stream outstream) in C:\Development\Misc\Libraries\dotnetzip-85217\Zip\ZipEntry.Write.cs:line 2442   at Ionic.Zip.ZipEntry.CopyThroughOneEntry(Stream outStream) in C:\Development\Misc\Libraries\dotnetzip-85217\Zip\ZipEntry.Write.cs:line 2385   at Ionic.Zip.ZipEntry.Write(Stream s) in C:\Development\Misc\Libraries\dotnetzip-85217\Zip\ZipEntry.Write.cs:line 2089

And it ONLY happens if you modify something in the ZIP File ... Add / Remove then Add.