We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 692d84e + 0145473 commit 4701875Copy full SHA for 4701875
src/utils/disk_usage.rs
@@ -8,11 +8,13 @@ impl DiskUsage {
8
pub(crate) fn fetch() -> Fallible<Self> {
9
#[cfg(unix)]
10
{
11
- let stat = nix::sys::statvfs::statvfs(&crate::utils::path::normalize_path(
12
- &crate::dirs::WORK_DIR,
13
- ))?;
+ let path = crate::utils::path::normalize_path(&crate::dirs::WORK_DIR);
+ let stat = nix::sys::statvfs::statvfs(&path)?;
+ let available = stat.blocks_available();
14
+ let total = stat.blocks();
15
+ info!("{available} / {total} blocks used in {path:?}");
16
Ok(Self {
- usage: stat.blocks_available() as f32 / stat.blocks() as f32,
17
+ usage: available as f32 / total as f32,
18
})
19
}
20
#[cfg(not(unix))]
0 commit comments