Skip to content
Snippets Groups Projects
Commit 41a656af authored by Jeremy Soller's avatar Jeremy Soller
Browse files

Ignore live disks and partitions in TUI

parent fadb0a1c
No related branches found
No related tags found
No related merge requests found
...@@ -35,6 +35,11 @@ fn disk_paths(paths: &mut Vec<(String, u64)>) { ...@@ -35,6 +35,11 @@ fn disk_paths(paths: &mut Vec<(String, u64)>) {
if let Ok(path_str) = path.into_os_string().into_string() { if let Ok(path_str) = path.into_os_string().into_string() {
let scheme = path_str.trim_start_matches(':').trim_matches('/'); let scheme = path_str.trim_start_matches(':').trim_matches('/');
if scheme.starts_with("disk") { if scheme.starts_with("disk") {
if scheme == "disk/live" {
// Skip live disks
continue;
}
schemes.push(format!("{}:", scheme)); schemes.push(format!("{}:", scheme));
} }
} }
...@@ -53,11 +58,18 @@ fn disk_paths(paths: &mut Vec<(String, u64)>) { ...@@ -53,11 +58,18 @@ fn disk_paths(paths: &mut Vec<(String, u64)>) {
match fs::read_dir(&scheme) { match fs::read_dir(&scheme) {
Ok(entries) => for entry_res in entries { Ok(entries) => for entry_res in entries {
if let Ok(entry) = entry_res { if let Ok(entry) = entry_res {
if let Ok(path) = entry.path().into_os_string().into_string() { if let Ok(file_name) = entry.file_name().into_string() {
if let Ok(metadata) = entry.metadata() { if file_name.contains('p') {
let size = metadata.len(); // Skip partitions
if size > 0 { continue;
paths.push((path, size)); }
if let Ok(path) = entry.path().into_os_string().into_string() {
if let Ok(metadata) = entry.metadata() {
let size = metadata.len();
if size > 0 {
paths.push((path, size));
}
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment