Skip to content

Commit

Permalink
what's up with windows?
Browse files Browse the repository at this point in the history
  • Loading branch information
dlowe committed Nov 27, 2024
1 parent 51b7017 commit 411b18d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
13 changes: 5 additions & 8 deletions src/windows/disk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,16 +185,13 @@ impl DiskInner {
}

if refreshes.details() && self.total_space != 0 {
let available_space = unsafe {
let mut tmp = 0;
let lpdirectoryname = PCWSTR::from_raw(self.mount_point.as_ptr());
if GetDiskFreeSpaceExW(lpdirectoryname, None, None, Some(&mut tmp)).is_ok() {
tmp
} else {
0
}
let (total_space, available_space) = if refreshes.details() {
get_drive_size(&self.mount_point).unwrap_or_default()
} else {
(0, 0)
};

self.total_space = total_space;
self.available_space = available_space;
}
false
Expand Down
2 changes: 1 addition & 1 deletion tests/disk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fn test_disk_refresh_kind() {
if refreshes.kind() {
// This would ideally assert that *all* are refreshed, but we settle for a weaker
// assertion because failures can't be distinguished from "not refreshed" values.
#[cfg(not(target_os = "freebsd"))]
#[cfg(not(any(target_os = "freebsd", target_os = "windows")))]
assert!(
disks
.iter()
Expand Down

0 comments on commit 411b18d

Please sign in to comment.