mirror of
https://github.com/ouch-org/ouch.git
synced 2025-07-19 16:10:53 +00:00
fixup windows zip while unpacking should use symlink_dir
Signed-off-by: tommady <tommady@users.noreply.github.com>
This commit is contained in:
parent
8280b9edb2
commit
e365c93f11
@ -38,18 +38,14 @@ pub fn unpack_archive(reader: Box<dyn Read>, output_folder: &Path, quiet: bool)
|
|||||||
.link_name()?
|
.link_name()?
|
||||||
.ok_or_else(|| std::io::Error::new(std::io::ErrorKind::InvalidData, "Missing symlink target"))?;
|
.ok_or_else(|| std::io::Error::new(std::io::ErrorKind::InvalidData, "Missing symlink target"))?;
|
||||||
|
|
||||||
if target.is_file() {
|
#[cfg(unix)]
|
||||||
#[cfg(unix)]
|
std::os::unix::fs::symlink(&target, &full_path)?;
|
||||||
std::os::unix::fs::symlink(&target, &full_path)?;
|
|
||||||
#[cfg(windows)]
|
// FIXME: how to detect whether the destination is a folder or a regular file?
|
||||||
std::os::windows::fs::symlink_file(&target, &full_path)?;
|
// regular file should use fs::symlink_file
|
||||||
}
|
// folder should use fs::symlink_file
|
||||||
if target.is_dir() {
|
#[cfg(windows)]
|
||||||
#[cfg(unix)]
|
std::os::windows::fs::symlink_file(&target, &full_path)?;
|
||||||
std::os::unix::fs::symlink(&target, &full_path)?;
|
|
||||||
#[cfg(windows)]
|
|
||||||
std::os::windows::fs::symlink_dir(&target, &full_path)?;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
tar::EntryType::Regular | tar::EntryType::Directory => {
|
tar::EntryType::Regular | tar::EntryType::Directory => {
|
||||||
file.unpack_in(output_folder)?;
|
file.unpack_in(output_folder)?;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user