gravityfile-core
The data model shared by gravityfile, a disk usage analyzer and file explorer: the scanned tree, scan settings, size formatting, configuration paths and scan history.
This crate exists for the grav binary and its sibling crates. Its API
follows their needs and can change in any minor release.
FileTreeis a scanned directory: aFileNoderoot, the absoluteroot_path,TreeStatstotals and the warnings collected on the way.FileNodeis a file, directory or symlink. Directories hold their children sorted largest first and carry the size of their whole subtree.ScanConfigholds the scan settings: depth, hidden files, ignore patterns, symlinks, filesystem boundaries and hard-link counting.unitsformats and parses sizes and ages, with SI units by default.pathsfinds the configuration and data directories, honouringGRAVITYFILE_HOMEand the platform conventions.historyappends and reads the one-line scan summaries behindgrav history.
use ;
use ;
use Path;
use ;
let modified = with_modified;
let mut tree = new;
let file = new_file;
assert!;
tree.recount;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
Most code gets a FileTree from gravityfile-scan instead of building one.
Licence
MIT or Apache-2.0, at your option.