mirror of
https://github.com/veeso/termscp.git
synced 2025-12-07 09:36:00 -08:00
FsEntry as reference in remove method
This commit is contained in:
@@ -59,7 +59,7 @@ pub enum FileTransferError {
|
||||
NoSuchFileOrDirectory,
|
||||
ProtocolError,
|
||||
UninitializedSession,
|
||||
UnknownError,
|
||||
//UnknownError,
|
||||
}
|
||||
|
||||
impl FileTransferError {
|
||||
@@ -79,7 +79,7 @@ impl FileTransferError {
|
||||
FileTransferError::NoSuchFileOrDirectory => String::from("No such file or directory"),
|
||||
FileTransferError::ProtocolError => String::from("Protocol error"),
|
||||
FileTransferError::UninitializedSession => String::from("Uninitialized session"),
|
||||
FileTransferError::UnknownError => String::from("Unknown error"),
|
||||
//FileTransferError::UnknownError => String::from("Unknown error"),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ pub trait FileTransfer {
|
||||
/// ### remove
|
||||
///
|
||||
/// Remove a file or a directory
|
||||
fn remove(&self, file: FsEntry) -> Result<(), FileTransferError>;
|
||||
fn remove(&self, file: &FsEntry) -> Result<(), FileTransferError>;
|
||||
|
||||
/// ### send_file
|
||||
///
|
||||
|
||||
@@ -330,7 +330,7 @@ impl FileTransfer for SftpFileTransfer {
|
||||
/// ### remove
|
||||
///
|
||||
/// Remove a file or a directory
|
||||
fn remove(&self, file: FsEntry) -> Result<(), FileTransferError> {
|
||||
fn remove(&self, file: &FsEntry) -> Result<(), FileTransferError> {
|
||||
match self.sftp.as_ref() {
|
||||
None => Err(FileTransferError::UninitializedSession),
|
||||
Some(sftp) => {
|
||||
@@ -350,7 +350,7 @@ impl FileTransfer for SftpFileTransfer {
|
||||
Ok(entries) => {
|
||||
// Remove each entry
|
||||
for entry in entries {
|
||||
if let Err(err) = self.remove(entry) {
|
||||
if let Err(err) = self.remove(&entry) {
|
||||
return Err(err);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user