weird /proc/<number>/smaps_rollup error
This commit is contained in:
parent
2dcb49dd80
commit
4f82deac1a
1 changed files with 15 additions and 7 deletions
22
src/main.rs
22
src/main.rs
|
|
@ -237,7 +237,7 @@ impl PreviewWidget<'_> {
|
|||
}
|
||||
|
||||
fn not_a_dir(&mut self, absolute_path: &PathBuf) {
|
||||
match absolute_path.is_file() {
|
||||
match absolute_path.exists() && absolute_path.is_file() {
|
||||
true => {
|
||||
let block = Block::new()
|
||||
.borders(Borders::ALL)
|
||||
|
|
@ -254,7 +254,11 @@ impl PreviewWidget<'_> {
|
|||
self.invalid_data();
|
||||
}
|
||||
ErrorKind::PermissionDenied => self.permission_denied(),
|
||||
_ => panic!("Problem with reading the contents of the file:\n{err:?}"),
|
||||
_ => {
|
||||
self.list = List::new(vec!["Cannot read file"])
|
||||
.block(block)
|
||||
.style(Color::Red)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
@ -264,11 +268,15 @@ impl PreviewWidget<'_> {
|
|||
.padding(Padding::symmetric(1, 1))
|
||||
.fg(Color::Blue);
|
||||
|
||||
self.list = List::new(vec![
|
||||
"This is neither a directory or a file\nI have no idea what to do with this",
|
||||
])
|
||||
.block(block)
|
||||
.style(Color::Red)
|
||||
if absolute_path.exists() {
|
||||
self.list = List::new(vec!["This is neither a directory\nOr a file"])
|
||||
.block(block)
|
||||
.style(Color::Red)
|
||||
} else {
|
||||
self.list = List::new(vec!["This file does not exist anymore"])
|
||||
.block(block)
|
||||
.style(Color::Red)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue