Allow Trash to fallback to Delete on failure (#27682)
This fixes trashing files from the git panel on SSH remotes that don't run a Desktop environment. Release Notes: - Fix trash to work on remotes with no desktop environment configured
This commit is contained in:
parent
55c1f9d26c
commit
08bb17a7eb
1 changed files with 6 additions and 1 deletions
|
@ -453,7 +453,12 @@ impl Fs for RealFs {
|
||||||
let file = smol::fs::File::open(path).await?;
|
let file = smol::fs::File::open(path).await?;
|
||||||
match trash::trash_file(&file.as_fd()).await {
|
match trash::trash_file(&file.as_fd()).await {
|
||||||
Ok(_) => Ok(()),
|
Ok(_) => Ok(()),
|
||||||
Err(err) => Err(anyhow::Error::new(err)),
|
Err(err) => {
|
||||||
|
log::error!("Failed to trash file: {}", err);
|
||||||
|
// Trashing files can fail if you don't have a trashing dbus service configured.
|
||||||
|
// In that case, delete the file directly instead.
|
||||||
|
return self.remove_file(path, RemoveOptions::default()).await;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue