This seems to be a bug.
When extracting an archive, directory creation fails when a subdirectory is to be extracted, but its parent directory in the archive has not yet been created. On the below exawmple structue, this issue occurs when trying to extract file_x earlier than file_y.
Example - extracting the below archive into d:\temp:
/dir1/
/subdir1/
/subdir1/file_x
/file_y
/dir2/
What specifically happens is that as the mz_dir_make function in mz_os.c runs to create the directory dir1/subdir1 for file_x on the file system, it goes ahead and breaks down the full Windows path d:\temp\dir1\subdir1 to components to be able to create it level-by-level, and it breaks it up based on path-separators (obviously), attempting to create them in this order:
d:
d:\temp
d:\temp\dir1
d:\temp\dir1\subdir1
That's to logic at least - but the first iteration fails, as CreateDirectoryW in mz_os_win32.c yields ERROR_ACCESS_DENIED for a drive letter, preventing the loop from continuing with the iteration on the target path, and ends up returning MZ_INTERNAL_ERROR from mz_zip_reader_save_all.
This is specific to Windows and to archives where subdirs occur before files on the same level inside a directory.
This seems to be a bug.
When extracting an archive, directory creation fails when a subdirectory is to be extracted, but its parent directory in the archive has not yet been created. On the below exawmple structue, this issue occurs when trying to extract file_x earlier than file_y.
Example - extracting the below archive into d:\temp:
/dir1/
/subdir1/
/subdir1/file_x
/file_y
/dir2/
What specifically happens is that as the mz_dir_make function in mz_os.c runs to create the directory dir1/subdir1 for file_x on the file system, it goes ahead and breaks down the full Windows path d:\temp\dir1\subdir1 to components to be able to create it level-by-level, and it breaks it up based on path-separators (obviously), attempting to create them in this order:
d:
d:\temp
d:\temp\dir1
d:\temp\dir1\subdir1
That's to logic at least - but the first iteration fails, as CreateDirectoryW in mz_os_win32.c yields ERROR_ACCESS_DENIED for a drive letter, preventing the loop from continuing with the iteration on the target path, and ends up returning MZ_INTERNAL_ERROR from mz_zip_reader_save_all.
This is specific to Windows and to archives where subdirs occur before files on the same level inside a directory.