Skip to content

Default "platform" field in zip files is set to "Unix" on Windows; need auto-detection or manual configuration #470

@roynor

Description

@roynor

Describe the bug
Hi there,
I've noticed that when using zip-rs to create zip files on Windows (i.e., when compiling for the Windows target), the "platform" metadata field in the generated zip files is defaulting to "Unix". This seems inconsistent, as the zip format typically uses "Dos" for Windows-generated archives and "Unix" for Unix-like systems (Linux, macOS, etc.).

To Reproduce
Steps to reproduce the behavior:

Expected behavior
It would be helpful to have either:

Automatic platform detection: The library should automatically set the "platform" field based on the target compilation platform (e.g., "Dos" for Windows targets, "Unix" for Unix-like targets).
Manual configuration option: A parameter/setting that allows users to explicitly specify the platform field (e.g., when creating a ZipWriter or configuring compression options) to override the default.

Screenshots

Additional context
Perhaps this issue can be resolved by modifying line 712 in types.rs. I have implemented a self-fix using the following code:
let mut local_block = ZipFileData {
#[cfg(windows)]
system: System::Dos,
#[cfg(linux)]
system: System::Unix,

Thanks for considering this! Let me know if more details are needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions