From e365c93f118e57ef6909992a778f57126626a2de Mon Sep 17 00:00:00 2001 From: tommady Date: Thu, 17 Jul 2025 09:51:57 +0000 Subject: [PATCH] fixup windows zip while unpacking should use symlink_dir Signed-off-by: tommady --- src/archive/tar.rs | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/archive/tar.rs b/src/archive/tar.rs index b0285e8..7b9b53a 100644 --- a/src/archive/tar.rs +++ b/src/archive/tar.rs @@ -38,18 +38,14 @@ pub fn unpack_archive(reader: Box, output_folder: &Path, quiet: bool) .link_name()? .ok_or_else(|| std::io::Error::new(std::io::ErrorKind::InvalidData, "Missing symlink target"))?; - if target.is_file() { - #[cfg(unix)] - std::os::unix::fs::symlink(&target, &full_path)?; - #[cfg(windows)] - std::os::windows::fs::symlink_file(&target, &full_path)?; - } - if target.is_dir() { - #[cfg(unix)] - std::os::unix::fs::symlink(&target, &full_path)?; - #[cfg(windows)] - std::os::windows::fs::symlink_dir(&target, &full_path)?; - } + #[cfg(unix)] + std::os::unix::fs::symlink(&target, &full_path)?; + + // FIXME: how to detect whether the destination is a folder or a regular file? + // regular file should use fs::symlink_file + // folder should use fs::symlink_file + #[cfg(windows)] + std::os::windows::fs::symlink_file(&target, &full_path)?; } tar::EntryType::Regular | tar::EntryType::Directory => { file.unpack_in(output_folder)?;