Wave 6: Integration tests, golden tests, index invariant tests, diff command (bd-rex, bd-2gp, bd-1ck)
This commit is contained in:
17
src/utils.rs
17
src/utils.rs
@@ -1 +1,16 @@
|
||||
// Utility functions
|
||||
use std::path::Path;
|
||||
|
||||
/// Compute total size of files in a directory (non-recursive, skips symlinks).
|
||||
///
|
||||
/// Used by doctor and cache commands to report disk usage per alias.
|
||||
pub fn dir_size(path: &Path) -> u64 {
|
||||
let Ok(entries) = std::fs::read_dir(path) else {
|
||||
return 0;
|
||||
};
|
||||
entries
|
||||
.filter_map(Result::ok)
|
||||
.filter_map(|e| e.metadata().ok())
|
||||
.filter(|m| m.is_file())
|
||||
.map(|m| m.len())
|
||||
.sum()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user