From 955b20a073eb566467158cf5089c923ca45e6748 Mon Sep 17 00:00:00 2001 From: Ben Bridle Date: Wed, 24 Apr 2024 16:11:53 +1200 Subject: Simplify file device debug messages --- src/devices/file.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/devices/file.rs b/src/devices/file.rs index d35acf9..236f9d1 100644 --- a/src/devices/file.rs +++ b/src/devices/file.rs @@ -71,11 +71,10 @@ impl FileDevice { pub fn write_to_open_port(&mut self, byte: u8) { if let Some(relative_path) = self.open_buffer.push_byte(byte) { - println!("Attempting to open path {relative_path:?}"); self.close_entry(); if !is_blank_path(&relative_path) { if let Ok(path) = self.attach_base(&relative_path) { - println!("Attempting to open absolute path {path:?}"); + println!("Attempting to open entry at: {path:?}"); let _ = self.open_entry(&path); }; } @@ -94,24 +93,20 @@ impl FileDevice { if !path.starts_with(&self.base_path) { return Err(()); } let metadata = raise_on_err!(metadata(&path)); if metadata.is_file() { - println!("Opening file as readable/writable"); if let Ok(file) = OpenOptions::new().read(true).write(true).open(&path) { self.close_entry(); let file_entry = Entry::File(BufferedFile::new(file)); self.entry = Some((file_entry, path.to_owned())); let relative = remove_base(&path, &self.base_path).unwrap(); self.name_buffer.populate(relative.as_os_str().as_bytes()); - println!("Success, opened file {path:?}"); return Ok(()); }; } else if metadata.is_dir() { - println!("Opening directory"); if let Ok(listing) = DirectoryListing::from_path(&path, &self.base_path) { let dir_entry = Entry::Directory(listing); self.entry = Some((dir_entry, path.to_owned())); let relative = remove_base(&path, &self.base_path).unwrap(); self.name_buffer.populate(relative.as_os_str().as_bytes()); - println!("Success, opened directory {path:?}"); return Ok(()); }; }; @@ -122,16 +117,17 @@ impl FileDevice { if let Some(dest) = self.move_buffer.push_byte(byte) { if let Some((_, source)) = &self.entry { if is_blank_path(&dest) { + eprintln!("Attempting to delete entry at: {source:?}"); self.move_success = delete_entry(&source); } else if let Ok(destination) = self.attach_base(&dest) { - println!("Attempting to move entry: {destination:?}"); + eprintln!("Attempting to move entry to: {destination:?}"); self.move_success = move_entry(&source, &destination); } } else { if is_blank_path(&dest) { self.move_success = false; } else if let Ok(destination) = self.attach_base(&dest) { - println!("Attempting to create entry: {destination:?}"); + eprintln!("Attempting to create entry at: {destination:?}"); self.move_success = create_file(&destination); } } -- cgit v1.2.3-70-g09d2