From 5b85c586afb9ec02466085235ee50258123826a9 Mon Sep 17 00:00:00 2001 From: zuozongtao Date: Wed, 5 Nov 2025 16:00:39 +0800 Subject: [PATCH 1/2] Fix #470:Default "platform" field in zip files is set to "Unix" on Windows; need auto-detection or manual configuration --- src/types.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/types.rs b/src/types.rs index 8bbebff05..a7bb447d8 100644 --- a/src/types.rs +++ b/src/types.rs @@ -709,8 +709,15 @@ impl ZipFileData { let permissions = options.permissions.unwrap_or(0o100644); let file_name: Box = name.to_string().into_boxed_str(); let file_name_raw: Box<[u8]> = file_name.bytes().collect(); + let system = if cfg!(windows) { + System::Dos + } else if cfg!(linux) { + System::Unix + } else { + System::Unknown + }; let mut local_block = ZipFileData { - system: System::Unix, + system: system, version_made_by: DEFAULT_VERSION, flags: 0, encrypted: options.encrypt_with.is_some() || { From cb21fca983a5f0a8625ac757ec496d9bf015e176 Mon Sep 17 00:00:00 2001 From: zuozongtao Date: Wed, 5 Nov 2025 16:47:31 +0800 Subject: [PATCH 2/2] fix: platform set to Dos on windows and set to Unix on others. --- src/types.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/types.rs b/src/types.rs index a7bb447d8..7b206863b 100644 --- a/src/types.rs +++ b/src/types.rs @@ -711,10 +711,8 @@ impl ZipFileData { let file_name_raw: Box<[u8]> = file_name.bytes().collect(); let system = if cfg!(windows) { System::Dos - } else if cfg!(linux) { - System::Unix } else { - System::Unknown + System::Unix }; let mut local_block = ZipFileData { system: system,