Misc: Rewrite code for reading/writing zip files #13763
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Changes
This introduces new classes for reading/writing zip files to replace the existing functions in
ZipHelpers.h. These provide a proper RAII wrapper around libzip that integrates with ourErrorclass.Rationale behind Changes
zip_open_managedandzip_open_buffer_managedfunctions are both affected by the following issues:zip_closeis called from a customstd::unique_ptrdeleter, there's no way to pass error information up the call stack, and sincezip_closeis the step that causes the original file on disk to be replaced with the new one, this error information is meaningful (for example, if there is a permissions problem).zip_closeis an error code, which it is not.ReadFileInZipToContainer,ZIP_FL_NOCASEis passed to functions that don't check for it.Errorclass, and I haven't found an existing one that I'm confident is high quality.Suggested Testing Steps
Not yet ready for testing.
Did you use AI to help find, test, or implement this issue or feature?
No.