mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
fix: support windows copy symlink to path
This commit is contained in:
parent
7a3c70f144
commit
c411c52b43
1 changed files with 20 additions and 3 deletions
|
|
@ -52,10 +52,27 @@ pub fn copy_with_progress(from: &Path, to: &Path) -> mpsc::Receiver<Result<u64,
|
||||||
|
|
||||||
async move {
|
async move {
|
||||||
if is_symlink {
|
if is_symlink {
|
||||||
|
#[cfg(unix)]
|
||||||
|
{
|
||||||
_ = match fs::symlink(from, to).await {
|
_ = match fs::symlink(from, to).await {
|
||||||
Ok(()) => tick_tx.send(Ok(1)),
|
Ok(()) => tick_tx.send(Ok(1)),
|
||||||
Err(e) => tick_tx.send(Err(e)),
|
Err(e) => tick_tx.send(Err(e)),
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
#[cfg(windows)]
|
||||||
|
{
|
||||||
|
if from.is_dir() {
|
||||||
|
_ = match fs::symlink_dir(from, to).await {
|
||||||
|
Ok(()) => tick_tx.send(Ok(1)),
|
||||||
|
Err(e) => tick_tx.send(Err(e)),
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_ = match fs::symlink_file(from, to).await {
|
||||||
|
Ok(()) => tick_tx.send(Ok(1)),
|
||||||
|
Err(e) => tick_tx.send(Err(e)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
_ = match fs::copy(from, to).await {
|
_ = match fs::copy(from, to).await {
|
||||||
Ok(len) => tick_tx.send(Ok(len)),
|
Ok(len) => tick_tx.send(Ok(len)),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue