This project is read-only.

.save(filename) fails on second call with another filename

May 1, 2010 at 8:26 AM


I've create an Issue Item yesterday (#10735), but it might have been better to first post it on the discussion list (my apologies):

I'm trying to save an existing ZipFile to another filename, but using the .Save(filename) throws an error.

Code snippet:
ZipFile zip = new ZipFile();
zip.AddFile(@"d:\test.txt"); // simple existing file
zip.Save(@"d:\"); // works perfectly
zip.Save(@"d:\"); // fails with error Could not find file 'd:\'.

I'm using this in a scenario where a program adds all kinds of documents to the ZipFile and the user can use a "File, Save As..." menu.

Can anyone explain me what is wrong with the code above and how to make it work? If it is a issue with the current version (1.9), does anyone has a workaround?

Kind regards,

Robbie De Sutter

May 3, 2010 at 8:09 PM

I think this might be a new problem.

The workaround is to close and then re-open the zip file, or... use File.Copy().