mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
..
This commit is contained in:
parent
029375c77f
commit
371ea501fd
1 changed files with 5 additions and 10 deletions
|
|
@ -86,26 +86,21 @@ impl Manager {
|
||||||
for (o, n) in todo {
|
for (o, n) in todo {
|
||||||
let (old, new) = (root.join(&o), root.join(&n));
|
let (old, new) = (root.join(&o), root.join(&n));
|
||||||
|
|
||||||
let new_url: Url = new.into();
|
if accessible(&new).await {
|
||||||
if accessible(&new_url).await {
|
|
||||||
failed.push((o, n, anyhow!("Destination already exists")));
|
failed.push((o, n, anyhow!("Destination already exists")));
|
||||||
} else if let Err(e) = fs::rename(&old, &new_url).await {
|
} else if let Err(e) = fs::rename(&old, &new).await {
|
||||||
failed.push((o, n, e.into()));
|
failed.push((o, n, e.into()));
|
||||||
} else if let Ok(f) = File::from(new_url).await {
|
} else if let Ok(f) = File::from(new.into()).await {
|
||||||
let old_url = Url::from(old);
|
succeeded.insert(Url::from(old), f.clone());
|
||||||
succeeded.insert(old_url.clone(), f.clone());
|
|
||||||
} else {
|
} else {
|
||||||
failed.push((o, n, anyhow!("Failed to retrieve file info")));
|
failed.push((o, n, anyhow!("Failed to retrieve file info")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !succeeded.is_empty() {
|
if !succeeded.is_empty() {
|
||||||
let changes: HashMap<_, _> =
|
// Pubsub::pub_from_bulk(tab, &changes);
|
||||||
succeeded.clone().into_iter().map(|(old, new)| (old, new.url)).collect();
|
|
||||||
|
|
||||||
FilesOp::Upserting(cwd, succeeded).emit();
|
FilesOp::Upserting(cwd, succeeded).emit();
|
||||||
|
|
||||||
Pubsub::pub_from_bulk(tab, &changes);
|
|
||||||
}
|
}
|
||||||
drop(permit);
|
drop(permit);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue