summaryrefslogtreecommitdiff
path: root/src/devices/file.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/file.rs')
-rw-r--r--src/devices/file.rs27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/devices/file.rs b/src/devices/file.rs
index 234da7c..e8db41a 100644
--- a/src/devices/file.rs
+++ b/src/devices/file.rs
@@ -32,7 +32,7 @@ pub struct FileDevice {
pub entry: Option<(Entry, PathBuf)>,
- pub move_success: bool,
+ pub op_success: bool,
pub new_pointer: u32,
pub new_length: u32,
@@ -57,7 +57,7 @@ impl FileDevice {
entry: None,
- move_success: false,
+ op_success: false,
new_pointer: 0,
new_length: 0,
@@ -137,22 +137,22 @@ impl FileDevice {
if let Some((_, source)) = &self.entry {
if is_blank_path(&dest) {
match self.enable_delete {
- true => self.move_success = delete_entry(&source),
- false => self.move_success = false,
+ true => self.op_success = delete_entry(&source),
+ false => self.op_success = false,
}
} else if let Ok(destination) = self.attach_base(&dest) {
match self.enable_move {
- true => self.move_success = move_entry(&source, &destination),
- false => self.move_success = false,
+ true => self.op_success = move_entry(&source, &destination),
+ false => self.op_success = false,
}
}
} else {
if is_blank_path(&dest) {
- self.move_success = false;
+ self.op_success = false;
} else if let Ok(destination) = self.attach_base(&dest) {
match self.enable_create {
- true => self.move_success = create_file(&destination),
- false => self.move_success = false,
+ true => self.op_success = create_file(&destination),
+ false => self.op_success = false,
}
}
}
@@ -164,12 +164,10 @@ impl FileDevice {
pub fn ascend_to_parent(&mut self) {
if let Some((_, path)) = &self.entry {
if let Some(parent_path) = path.parent() {
- let path = parent_path.to_owned();
- let _ = self.open_entry(&path);
+ self.op_success = self.open_entry(&parent_path.to_owned()).is_ok();
}
} else {
- let default_path = self.default_path.to_owned();
- let _ = self.open_entry(&default_path);
+ self.op_success = self.open_entry(&self.default_path.to_owned()).is_ok();
}
}
@@ -178,8 +176,7 @@ impl FileDevice {
if let Some((Entry::Directory(listing), _)) = &self.entry {
if let Some(child_path) = listing.child_path() {
if let Ok(child_path) = self.attach_base(&child_path) {
- let child_path = child_path.to_owned();
- let _ = self.open_entry(&child_path);
+ self.op_success = self.open_entry(&child_path).is_ok();
}
};
}