mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
..
This commit is contained in:
parent
dbb8c6d28f
commit
7f80ed8864
3 changed files with 19 additions and 19 deletions
|
|
@ -27,20 +27,20 @@ impl File {
|
|||
|
||||
pub(crate) async fn paste(&self, mut task: FileInPaste) -> Result<(), FileOutPaste> {
|
||||
if task.cut
|
||||
&& !task.follow1
|
||||
&& !task.follow
|
||||
&& ok_or_not_found(provider::rename(&task.from, &task.to).await).is_ok()
|
||||
{
|
||||
return Ok(self.ops.out(task.id, FileOutPaste::Succ));
|
||||
}
|
||||
|
||||
if task.cha.is_none() {
|
||||
task.cha = Some(Self::cha(&task.from, task.follow1, None).await?);
|
||||
task.cha = Some(Self::cha(&task.from, task.follow, None).await?);
|
||||
}
|
||||
|
||||
let cha = task.cha.unwrap();
|
||||
if !cha.is_dir() {
|
||||
let id = task.id;
|
||||
if cha.is_orphan() || (cha.is_link() && !task.follow1) {
|
||||
if cha.is_orphan() || (cha.is_link() && !task.follow) {
|
||||
self.ops.out(id, FileOutPaste::New(0));
|
||||
self.queue(task.into_link(), NORMAL);
|
||||
} else {
|
||||
|
|
@ -76,7 +76,7 @@ impl File {
|
|||
let mut it = continue_unless_ok!(provider::read_dir(&src).await);
|
||||
while let Ok(Some(entry)) = it.next().await {
|
||||
let from = entry.url();
|
||||
let cha = continue_unless_ok!(Self::cha(&from, task.follow1, Some(entry)).await);
|
||||
let cha = continue_unless_ok!(Self::cha(&from, task.follow, Some(entry)).await);
|
||||
|
||||
if cha.is_dir() {
|
||||
dirs.push_back(from);
|
||||
|
|
@ -84,7 +84,7 @@ impl File {
|
|||
}
|
||||
|
||||
let to = continue_unless_ok!(dest.try_join(from.name().unwrap()));
|
||||
if cha.is_orphan() || (cha.is_link() && !task.follow1) {
|
||||
if cha.is_orphan() || (cha.is_link() && !task.follow) {
|
||||
self.ops.out(task.id, FileOutPaste::New(0));
|
||||
self.queue(task.spawn(from, to, cha).into_link(), NORMAL);
|
||||
} else {
|
||||
|
|
@ -111,12 +111,12 @@ impl File {
|
|||
}
|
||||
Ok(n) => self.ops.out(task.id, FileOutPasteDo::Adv(n)),
|
||||
Err(e) if e.kind() == NotFound => {
|
||||
let Ok(cha) = Self::cha(&task.from, task.follow1, None).await else {
|
||||
let Ok(cha) = Self::cha(&task.from, task.follow, None).await else {
|
||||
warn!("Paste task partially done: {task:?}");
|
||||
break;
|
||||
};
|
||||
|
||||
if cha.is_orphan() || (cha.is_link() && !task.follow1) {
|
||||
if cha.is_orphan() || (cha.is_link() && !task.follow) {
|
||||
task.cha = Some(cha);
|
||||
return Ok(self.queue(task.into_link(), NORMAL));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ pub(crate) struct FileInPaste {
|
|||
pub(crate) to: UrlBuf,
|
||||
pub(crate) cha: Option<Cha>,
|
||||
pub(crate) cut: bool,
|
||||
pub(crate) follow1: bool,
|
||||
pub(crate) follow: bool,
|
||||
pub(crate) retry: u8,
|
||||
}
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ impl FileInPaste {
|
|||
to,
|
||||
cha: Some(cha),
|
||||
cut: self.cut,
|
||||
follow1: self.follow1,
|
||||
follow: self.follow,
|
||||
retry: self.retry,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,12 +97,12 @@ impl Scheduler {
|
|||
});
|
||||
|
||||
let file = self.file.clone();
|
||||
let follow1 = !from.scheme().covariant(to.scheme());
|
||||
let follow = !from.scheme().covariant(to.scheme());
|
||||
self.send_micro(id, LOW, async move {
|
||||
if !force {
|
||||
to = unique_name(to, must_be_dir(&from)).await?;
|
||||
}
|
||||
file.paste(FileInPaste { id, from, to, cha: None, cut: true, follow1, retry: 0 }).await
|
||||
file.paste(FileInPaste { id, from, to, cha: None, cut: true, follow, retry: 0 }).await
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -118,12 +118,12 @@ impl Scheduler {
|
|||
}
|
||||
|
||||
let file = self.file.clone();
|
||||
let follow1 = follow || !from.scheme().covariant(to.scheme());
|
||||
let follow = follow || !from.scheme().covariant(to.scheme());
|
||||
self.send_micro(id, LOW, async move {
|
||||
if !force {
|
||||
to = unique_name(to, must_be_dir(&from)).await?;
|
||||
}
|
||||
file.paste(FileInPaste { id, from, to, cha: None, cut: false, follow1, retry: 0 }).await
|
||||
file.paste(FileInPaste { id, from, to, cha: None, cut: false, follow, retry: 0 }).await
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue