mirror of
https://github.com/veeso/termscp.git
synced 2025-12-07 09:36:00 -08:00
It is now possible to enter symlinks
This commit is contained in:
@@ -916,8 +916,24 @@ impl FileTransferActivity {
|
|||||||
// Match selected file
|
// Match selected file
|
||||||
let local_files: Vec<FsEntry> = self.local.files.clone();
|
let local_files: Vec<FsEntry> = self.local.files.clone();
|
||||||
if let Some(entry) = local_files.get(self.local.index) {
|
if let Some(entry) = local_files.get(self.local.index) {
|
||||||
if let FsEntry::Directory(dir) = entry {
|
// If directory, enter directory, otherwise check if symlink
|
||||||
self.local_changedir(dir.abs_path.as_path(), true);
|
match entry {
|
||||||
|
FsEntry::Directory(dir) => self.local_changedir(dir.abs_path.as_path(), true),
|
||||||
|
FsEntry::File(file) => {
|
||||||
|
// Check if symlink
|
||||||
|
if let Some(realpath) = &file.symlink {
|
||||||
|
// Stat realpath
|
||||||
|
match self.context.as_ref().unwrap().local.stat(realpath.as_path()) {
|
||||||
|
Ok(real_file) => {
|
||||||
|
// If real file is a directory, enter directory
|
||||||
|
if let FsEntry::Directory(real_dir) = real_file {
|
||||||
|
self.local_changedir(real_dir.abs_path.as_path(), true)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Err(err) => self.log(LogLevel::Error, format!("Failed to stat file \"{}\": {}", realpath.display(), err).as_ref())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1082,9 +1098,24 @@ impl FileTransferActivity {
|
|||||||
// Match selected file
|
// Match selected file
|
||||||
let files: Vec<FsEntry> = self.remote.files.clone();
|
let files: Vec<FsEntry> = self.remote.files.clone();
|
||||||
if let Some(entry) = files.get(self.remote.index) {
|
if let Some(entry) = files.get(self.remote.index) {
|
||||||
if let FsEntry::Directory(dir) = entry {
|
// If directory, enter directory; if file, check if is symlink
|
||||||
// Get current directory
|
match entry {
|
||||||
self.remote_changedir(dir.abs_path.as_path(), true);
|
FsEntry::Directory(dir) => self.remote_changedir(dir.abs_path.as_path(), true),
|
||||||
|
FsEntry::File(file) => {
|
||||||
|
// Check if symlink
|
||||||
|
if let Some(realpath) = &file.symlink {
|
||||||
|
// Stat realpath
|
||||||
|
match self.client.stat(realpath.as_path()) {
|
||||||
|
Ok(real_file) => {
|
||||||
|
// If real file is a directory, enter directory
|
||||||
|
if let FsEntry::Directory(real_dir) = real_file {
|
||||||
|
self.remote_changedir(real_dir.abs_path.as_path(), true)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Err(err) => self.log(LogLevel::Error, format!("Failed to stat file \"{}\": {}", realpath.display(), err).as_ref())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user