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:
+6
-1
@@ -453,7 +453,12 @@ impl Fs for RealFs {
|
||||
let file = smol::fs::File::open(path).await?;
|
||||
match trash::trash_file(&file.as_fd()).await {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user