Skip to content

Commit

Permalink
Allow opening read-only ZIP files (#278)
Browse files Browse the repository at this point in the history
  • Loading branch information
thp committed Sep 16, 2022
1 parent 114d9d4 commit 7a57414
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/zip.c
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,15 @@ struct zip_t *zip_open(const char *zipname, int level, char mode) {
break;

case 'r':
if (!mz_zip_reader_init_file_v2(
&(zip->archive), zipname,
zip->level | MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY, 0, 0)) {
// An archive file does not exist or cannot initialize
// zip_archive reader
goto cleanup;
}
break;

case 'a':
case 'd':
if (!mz_zip_reader_init_file_v2_rpb(
Expand Down

0 comments on commit 7a57414

Please sign in to comment.