mirror of
https://github.com/veeso/termscp.git
synced 2025-12-07 09:36:00 -08:00
Changed FileReadonly with Permissionn error
This commit is contained in:
@@ -62,9 +62,9 @@ pub enum FileTransferErrorType {
|
|||||||
SslError,
|
SslError,
|
||||||
DirStatFailed,
|
DirStatFailed,
|
||||||
FileCreateDenied,
|
FileCreateDenied,
|
||||||
FileReadonly,
|
|
||||||
IoErr(std::io::Error),
|
IoErr(std::io::Error),
|
||||||
NoSuchFileOrDirectory,
|
NoSuchFileOrDirectory,
|
||||||
|
PexError,
|
||||||
ProtocolError,
|
ProtocolError,
|
||||||
UninitializedSession,
|
UninitializedSession,
|
||||||
UnsupportedFeature,
|
UnsupportedFeature,
|
||||||
@@ -101,11 +101,11 @@ impl std::fmt::Display for FileTransferError {
|
|||||||
FileTransferErrorType::ConnectionError => String::from("Connection error"),
|
FileTransferErrorType::ConnectionError => String::from("Connection error"),
|
||||||
FileTransferErrorType::DirStatFailed => String::from("Could not stat directory"),
|
FileTransferErrorType::DirStatFailed => String::from("Could not stat directory"),
|
||||||
FileTransferErrorType::FileCreateDenied => String::from("Failed to create file"),
|
FileTransferErrorType::FileCreateDenied => String::from("Failed to create file"),
|
||||||
FileTransferErrorType::FileReadonly => String::from("File is readonly"),
|
|
||||||
FileTransferErrorType::IoErr(err) => format!("IO Error: {}", err),
|
FileTransferErrorType::IoErr(err) => format!("IO Error: {}", err),
|
||||||
FileTransferErrorType::NoSuchFileOrDirectory => {
|
FileTransferErrorType::NoSuchFileOrDirectory => {
|
||||||
String::from("No such file or directory")
|
String::from("No such file or directory")
|
||||||
}
|
}
|
||||||
|
FileTransferErrorType::PexError => String::from("Not enough permissions"),
|
||||||
FileTransferErrorType::ProtocolError => String::from("Protocol error"),
|
FileTransferErrorType::ProtocolError => String::from("Protocol error"),
|
||||||
FileTransferErrorType::SslError => String::from("SSL error"),
|
FileTransferErrorType::SslError => String::from("SSL error"),
|
||||||
FileTransferErrorType::UninitializedSession => String::from("Uninitialized session"),
|
FileTransferErrorType::UninitializedSession => String::from("Uninitialized session"),
|
||||||
|
|||||||
@@ -341,7 +341,7 @@ impl FileTransfer for SftpFileTransfer {
|
|||||||
// Remove file
|
// Remove file
|
||||||
match sftp.unlink(f.abs_path.as_path()) {
|
match sftp.unlink(f.abs_path.as_path()) {
|
||||||
Ok(_) => Ok(()),
|
Ok(_) => Ok(()),
|
||||||
Err(err) => Err(FileTransferError::new_ex(FileTransferErrorType::FileReadonly, format!("{}", err))),
|
Err(err) => Err(FileTransferError::new_ex(FileTransferErrorType::PexError, format!("{}", err))),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FsEntry::Directory(d) => {
|
FsEntry::Directory(d) => {
|
||||||
@@ -358,7 +358,7 @@ impl FileTransfer for SftpFileTransfer {
|
|||||||
// Finally remove directory
|
// Finally remove directory
|
||||||
match sftp.rmdir(d.abs_path.as_path()) {
|
match sftp.rmdir(d.abs_path.as_path()) {
|
||||||
Ok(_) => Ok(()),
|
Ok(_) => Ok(()),
|
||||||
Err(err) => Err(FileTransferError::new_ex(FileTransferErrorType::FileReadonly, format!("{}", err))),
|
Err(err) => Err(FileTransferError::new_ex(FileTransferErrorType::PexError, format!("{}", err))),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(err) => return Err(err),
|
Err(err) => return Err(err),
|
||||||
|
|||||||
Reference in New Issue
Block a user