Optimized code for fsentry

This commit is contained in:
ChristianVisintin
2020-12-12 16:32:21 +01:00
parent f73e43304e
commit 57e83a63dd
5 changed files with 10 additions and 40 deletions

View File

@@ -244,10 +244,7 @@ impl Localhost {
///
/// Rename file or directory to new name
pub fn rename(&mut self, entry: &FsEntry, dst_path: &Path) -> Result<(), HostError> {
let abs_path: PathBuf = match entry {
FsEntry::Directory(dir) => dir.abs_path.clone(),
FsEntry::File(f) => f.abs_path.clone(),
};
let abs_path: PathBuf = entry.get_abs_path();
match std::fs::rename(abs_path.as_path(), dst_path) {
Ok(_) => {
// Scan dir