From e3f4b3da9ea246c9dd1f53052ae3af348d751cb7 Mon Sep 17 00:00:00 2001 From: Julian Hasreiter <75797743+Pinguin2001@users.noreply.github.com> Date: Sat, 9 Nov 2024 12:48:09 +0100 Subject: [PATCH] fix: disk stats on windows --- src-tauri/src/main.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 0b3e98a..d1a6100 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -124,8 +124,16 @@ async fn get_processes(state: State<'_, AppState>) -> Result<(Vec, // Calculate total disk usage - only for physical disks let disk_stats = sys.disks().iter() .filter(|disk| { - // Filter for physical disks - typically those mounted at "/" - disk.mount_point() == std::path::Path::new("/") + // Filter for physical disks - typically those mounted at "/" on unix-systems + #[cfg(any(target_os = "linux", target_os = "macos"))] + { + disk.mount_point() == std::path::Path::new("/") + } + // Filter for physical disks - typically those mounted at "C:\" on windows + #[cfg(target_os = "windows")] + { + disk.mount_point() == std::path::Path::new("C:\\") + } }) .fold((0, 0, 0), |acc, disk| { (