summaryrefslogtreecommitdiffstats
path: root/src/utils.rs
diff options
context:
space:
mode:
authorquentin konieczko <konieczko@gmail.com>2023-05-17 15:50:27 +0200
committerquentin konieczko <konieczko@gmail.com>2023-05-17 15:50:27 +0200
commit9bf9d8c8b3c5d35c63ca9310b8cdb9cf3e46fec7 (patch)
tree3838dc0aedce6de5a40f1fe06808c6b005659578 /src/utils.rs
parentb37fee56b1466780aa9451070e64ebdc9fb1c84d (diff)
fix comparison between disks couldn't compile on some platform.
Diffstat (limited to 'src/utils.rs')
-rw-r--r--src/utils.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/utils.rs b/src/utils.rs
index 8f9c645..99a3a39 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -55,6 +55,14 @@ pub fn disk_space(disks: &[Disk], path: &Path) -> String {
disk_space_used(disk_used_by_path(disks, path))
}
+/// Takes a disk and returns its mount point.
+/// Returns `None` if it received `None`.
+/// It's a poor fix to support OSX where `sysinfo::Disk` doesn't implement `PartialEq`.
+pub fn opt_mount_point(disk: Option<&Disk>) -> Option<&std::path::Path> {
+ let Some(disk) = disk else { return None; };
+ Some(disk.mount_point())
+}
+
/// Drops everything holding an `Arc<Term>`.
/// If new structs holding `Arc<Term>` are introduced
/// (surelly to display something on their own...), we'll have to pass them