Add Rename
This commit is contained in:
parent
8fed9dd216
commit
1dc9b9c1b1
4 changed files with 145 additions and 1 deletions
|
|
@ -29,6 +29,10 @@ pub enum Operation {
|
|||
NewFolder {
|
||||
path: PathBuf,
|
||||
},
|
||||
Rename {
|
||||
from: PathBuf,
|
||||
to: PathBuf,
|
||||
},
|
||||
/// Restore a path from the trash
|
||||
Restore {
|
||||
paths: Vec<trash::TrashItem>,
|
||||
|
|
@ -74,6 +78,13 @@ impl Operation {
|
|||
.map_err(err_str)?;
|
||||
let _ = msg_tx.send(Message::PendingProgress(id, 100.0)).await;
|
||||
}
|
||||
Self::Rename { from, to } => {
|
||||
tokio::task::spawn_blocking(|| fs::rename(from, to))
|
||||
.await
|
||||
.map_err(err_str)?
|
||||
.map_err(err_str)?;
|
||||
let _ = msg_tx.send(Message::PendingProgress(id, 100.0)).await;
|
||||
}
|
||||
Self::Restore { paths } => {
|
||||
let total = paths.len();
|
||||
let mut count = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue