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,
|
NoSuchFileOrDirectory,
|
||||||
ProtocolError,
|
ProtocolError,
|
||||||
UninitializedSession,
|
UninitializedSession,
|
||||||
UnknownError,
|
//UnknownError,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FileTransferError {
|
impl FileTransferError {
|
||||||
@@ -79,7 +79,7 @@ impl FileTransferError {
|
|||||||
FileTransferError::NoSuchFileOrDirectory => String::from("No such file or directory"),
|
FileTransferError::NoSuchFileOrDirectory => String::from("No such file or directory"),
|
||||||
FileTransferError::ProtocolError => String::from("Protocol error"),
|
FileTransferError::ProtocolError => String::from("Protocol error"),
|
||||||
FileTransferError::UninitializedSession => String::from("Uninitialized session"),
|
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
|
||||||
///
|
///
|
||||||
/// Remove a file or a directory
|
/// Remove a file or a directory
|
||||||
fn remove(&self, file: FsEntry) -> Result<(), FileTransferError>;
|
fn remove(&self, file: &FsEntry) -> Result<(), FileTransferError>;
|
||||||
|
|
||||||
/// ### send_file
|
/// ### send_file
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -330,7 +330,7 @@ impl FileTransfer for SftpFileTransfer {
|
|||||||
/// ### remove
|
/// ### remove
|
||||||
///
|
///
|
||||||
/// Remove a file or a directory
|
/// 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() {
|
match self.sftp.as_ref() {
|
||||||
None => Err(FileTransferError::UninitializedSession),
|
None => Err(FileTransferError::UninitializedSession),
|
||||||
Some(sftp) => {
|
Some(sftp) => {
|
||||||
@@ -350,7 +350,7 @@ impl FileTransfer for SftpFileTransfer {
|
|||||||
Ok(entries) => {
|
Ok(entries) => {
|
||||||
// Remove each entry
|
// Remove each entry
|
||||||
for entry in entries {
|
for entry in entries {
|
||||||
if let Err(err) = self.remove(entry) {
|
if let Err(err) = self.remove(&entry) {
|
||||||
return Err(err);
|
return Err(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user