Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Trying to add files to an existing ZIP archive creates a NEW archive #201

Open
zipgenius opened this issue Sep 29, 2023 · 1 comment
Open

Comments

@zipgenius
Copy link

zipgenius commented Sep 29, 2023

I have the following code that is trying to add files from a FileOpenPicker to an existing zip archive

... var sFiles = await pickerFiles.PickMultipleFilesAsync(); List<string> files = new List<string>(); foreach (StorageFile entry in sFiles) { files.Add(entry.Path); } SevenZipBase.SetLibraryPath(@"C:\Libs\7z.dll"); SevenZipCompressor cp = new SevenZip.SevenZipCompressor(); string fName = @"\C:\Users\matte\desktop\test.zip"; cp.CompressFiles(fName, files.ToArray()); Debug.WriteLine("Check archive NOW!"); ...
I'd expected the new files to be added to those already in test.zip but I get a truly new archive holding just the lately added files.
It seems that SevenZipCompressor is always open the archive file in Create mode only every time.
Am I missing anything?

@squid-box
Copy link
Owner

You'll need to set the compressor's CompressionMode to Append
cp.CompressionMode = CompressionMode.Append;

Typically the unit tests are a good place to check for info, given the lack of documentation :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants