Function
change_directory
(sftp: &_Sftp, file_path: Option<&str>)
Source from the content-addressed store, hash-verified
| 327 | } |
| 328 | |
| 329 | async fn change_directory(sftp: &_Sftp, file_path: Option<&str>) -> Result<(), String> { |
| 330 | if let Some(path) = file_path { |
| 331 | let mut fs = sftp.fs(); |
| 332 | fs.set_cwd(path); |
| 333 | let result = fs.open_dir(path).await; |
| 334 | drop(fs); |
| 335 | if result.is_err() { |
| 336 | return Err(format!( |
| 337 | "Failed to change directory to {}: {}", |
| 338 | path, |
| 339 | result.err().unwrap() |
| 340 | )); |
| 341 | } |
| 342 | } |
| 343 | |
| 344 | Ok(()) |
| 345 | } |
| 346 | |
| 347 | async fn create_directories_if_non_existent( |
| 348 | sftp: &_Sftp, |
Tested by
no test coverage detected