(app_state: &AppState, raw_path: &str)
| 392 | } |
| 393 | |
| 394 | pub async fn delete_file(app_state: &AppState, raw_path: &str) -> Result<(), String> { |
| 395 | match resolve_desktop_path_target(app_state, raw_path, None).await? { |
| 396 | DesktopPathTarget::Local { resolved_path, .. } => app_state |
| 397 | .filesystem_service |
| 398 | .delete_file(&resolved_path.to_string_lossy()) |
| 399 | .await |
| 400 | .map_err(|e| format!("Failed to delete file: {}", e)), |
| 401 | DesktopPathTarget::Remote { |
| 402 | requested_path, |
| 403 | entry, |
| 404 | } => { |
| 405 | let remote_fs = app_state |
| 406 | .get_remote_file_service_async() |
| 407 | .await |
| 408 | .map_err(|e| format!("Remote file service not available: {}", e))?; |
| 409 | remote_fs |
| 410 | .remove_file(&entry.connection_id, &requested_path) |
| 411 | .await |
| 412 | .map_err(|e| format!("Failed to delete remote file: {}", e)) |
| 413 | } |
| 414 | } |
| 415 | } |
| 416 | |
| 417 | pub async fn delete_directory( |
| 418 | app_state: &AppState, |
nothing calls this directly
no test coverage detected